You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the packages from the latest CI build in an application using Humanizer that I'm trying to get published using native AoT, there's a single remaining warning when targeting net9.0:
/_/src/Humanizer/EnumCache.cs(77): Trim analysis error IL2072: Humanizer.EnumCache`1.TryGetDescription(MemberInfo,String&): 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties', 'DynamicallyAccessedMemberTypes.NonPublicProperties' in call to 'System.Reflection.RuntimeReflectionExtensions.GetRuntimeProperties(Type)'. The return value of method 'System.Object.GetType()' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
foreach(var property in attrType.GetRuntimeProperties())
I'm not sure what the intended fix for this scenario would be.
I took a look at the code locally, updating the .NET 9 RC2 SDK and adding a net9.0 target and the warning, plus an additional one appear, so these must be due to new annotations in the .NET 9 release.
1>C:\Coding\Humanizr\Humanizer\src\Humanizer\EnumDehumanizeExtensions.cs(30,53,31,72): error IL2026: Using member 'Humanizer.EnumDehumanizeExtensions.DehumanizeTo(String, Type, OnNoMatch)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. The native code for the target enumeration might not be available at runtime.
1>C:\Coding\Humanizr\Humanizer\src\Humanizer\EnumCache.cs(77,38,77,69): error IL2072: 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties', 'DynamicallyAccessedMemberTypes.NonPublicProperties' in call to 'System.Reflection.RuntimeReflectionExtensions.GetRuntimeProperties(Type)'. The return value of method 'System.Object.GetType()' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
The text was updated successfully, but these errors were encountered:
Using the packages from the latest CI build in an application using Humanizer that I'm trying to get published using native AoT, there's a single remaining warning when targeting
net9.0
:/_/src/Humanizer/EnumCache.cs(77): Trim analysis error IL2072: Humanizer.EnumCache`1.TryGetDescription(MemberInfo,String&): 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicProperties', 'DynamicallyAccessedMemberTypes.NonPublicProperties' in call to 'System.Reflection.RuntimeReflectionExtensions.GetRuntimeProperties(Type)'. The return value of method 'System.Object.GetType()' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.
This appears to correlate to this line of code:
Humanizer/src/Humanizer/EnumCache.cs
Line 77 in 38b2d1f
I'm not sure what the intended fix for this scenario would be.
I took a look at the code locally, updating the .NET 9 RC2 SDK and adding a
net9.0
target and the warning, plus an additional one appear, so these must be due to new annotations in the .NET 9 release.The text was updated successfully, but these errors were encountered: