Skip to content

Conversation

@adityapatwardhan
Copy link
Member

@adityapatwardhan adityapatwardhan commented Jan 24, 2019

PR Summary

Many types were already visible publicly either as attributes or as OutputType. This change marks them as public.

  • ValidateVariableNameAttribute - is used by a public property CommonParameters.ErrorVariable
  • ArgumentToVersionTransformationAttribute - is used by a public property SetStrictModeCommand.Version
  • ValidateVersionAttribute - is used by a public property SetStrictModeCommand.Version
  • EnumSingleTypeConverter and EnumMultipleTypeConverter - classes had public methods
  • ArgumentToModuleTransformationAttribute - used by Save-Help command for Module parameter.
  • ArgumentToEncodingTransformationAttribute - used by multiple cmdlets for Encoding parameter.

Also, changed the output type of Start-Job from PSRemotingJob to Job

PR Checklist

Copy link
Collaborator

@iSazonov iSazonov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For new public APIs we need PowerShell Committee approval.

@PaulHigin
Copy link
Contributor

What is the motivation for making these types public? For example, I believe PSRemotingJob was meant for internal implementation and only its base class Job was meant for public use.

Copy link
Collaborator

@JamesWTruher JamesWTruher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't enough context to suggest that there are any problems with this

@lzybkr
Copy link
Contributor

lzybkr commented Jan 25, 2019

I'm not totally sure I understand the motivation - maybe an upcoming change in the CLR?

I haven't reviewed the changes closely, but after a quick glance, if a CLR change forces these types to be public, I'd move them to an Internal namespace to make it clear they are implementation details, and probably add an Obsolete attribute to discourage/disallow their use in other assemblies.

@adityapatwardhan
Copy link
Member Author

@lzybkr - We are planning to use GenAPI to build reference assemblies. These types are not found when compiling the generated .cs file, as they are marked as internal. I believe all of them should be marked as public, hence the change.

@lzybkr
Copy link
Contributor

lzybkr commented Jan 26, 2019

I see. I'm assuming that custom attributes are always included in the reference assembly just in case a build tool like the C# compiler needs to see the attribute to generate correct code or check for errors.

I'm not aware of any build tool that needs to see PowerShell's attributes, so I would expect careful thought before blindly making these types public.

Many of the names are not good public apis - they maybe sound too general, e.g.

  • ArgumentToVersionTransformationAttribute is quite specific and special w.r.t. PowerShell versions
  • ValidateVariableName is missing the Attribute suffix and validates in a very specific way that is not as general as the name suggests.
  • ArgumentToModuleTransformationAttribute sounds promising and useful, yet it's only used in one place in PowerShell - so maybe it's not really that useful.

I wonder if EnumMultipleTypeConverter needs to be applied as an attribute at all - it's applied on types that are also Flags, so it's sort of ambiguous - should the conversion produce a single value or multiple values. If that could be removed, then maybe you can avoid exposing the Enum*TypeConverter types.

@daxian-dbw
Copy link
Member

EnumSingleTypeConverter and EnumMultipleTypeConverter - classes had public methods

Having public methods doesn't seem to be a strong argument to make them public. We have other internal types with public modifier applied to its methods or properties. These 2 types are not attributes, so how are they exposed by GenApi?

@iSazonov
Copy link
Collaborator

If GenAPI doesn't work because the types is visible externally it is GenAPI problem and it would be fixed in GenAPI. Or we could create a workaround on PowerShell to resolve the problem.

@adityapatwardhan
Copy link
Member Author

I will shortly add a gist of the .cs file generated by GenAPI.

@stale
Copy link

stale bot commented Feb 27, 2019

This PR has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs within 10 days.
Thank you for your contributions.
Community members are welcome to grab these works.

@stale stale bot added the Stale label Feb 27, 2019
@stale
Copy link

stale bot commented Mar 9, 2019

This PR has been automatically closed because it is stale. If you wish to continue working on the PR, please first update the PR, then reopen it.
Thanks again for your contribution.
Community members are welcome to grab these works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants