-
Notifications
You must be signed in to change notification settings - Fork 5k
TaskHostFactory
does not work with public properties with private get accessor as task parameters
#116012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think that is a .NET Runtime bug that such a difference exists. Reflection of a property from MetadataLoadContext uses the visibility of the get accessor if that exists, otherwise the set accessor: https://github.com/dotnet/runtime/blob/cf5369440e236aa783599761750b4f8e1f4aa719/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/Runtime/BindingFlagSupport/PropertyPolicies.cs Reflection of a runtime property instead computes Attributes.ComposedOfAllPrivateMethods and Attributes.ComposedOfNoPublicMembers flags: https://github.com/dotnet/runtime/blob/cf5369440e236aa783599761750b4f8e1f4aa719/src/coreclr/System.Private.CoreLib/src/System/Reflection/Associates.cs |
I did not find any dotnet/runtime issue for this. |
Triage: We should transfer this issue to runtime team. |
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov |
Tagging subscribers to this area: @dotnet/area-system-reflection |
So it sounds like we should make |
Issue Description
TaskHostFactory
does not allow using public properties with private get accessor as task parameters.Steps to Reproduce
A/A.cs
A/A.csproj
B/B.csproj
Test.cmd
Test.zip
Run
Test.cmd
from zip file.Expected Behavior
All calls to
dotnet build
should be successful.Actual Behavior
Call to
dotnet build B -p:UseTaskHost=True -p:TestParameter=S1
fails withAnalysis
https://github.com/dotnet/msbuild/blob/4ad462496537cd497f9c43531acb21f44d58cd67/src/Shared/LoadedType.cs#L70
When assembly loaded via
MetadataLoadContext
, then call totype.GetProperties(BindingFlags.Instance | BindingFlags.Public);
will not return public properties with private get accessor. But when assembly loaded for execution, then such properties will be included.Versions & Configurations
The text was updated successfully, but these errors were encountered: