-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
System.Security.Policy.Evidence missing in .NET Platform Extensions for .net framework #99447
Comments
Indeed it looks like we're missing these type-forwards from the |
The latest APICompat finds these problems:
I think in 6.0 it would have been missed because the old API compat never compared between netstandard2.0 and net4* (that was added in the new package-based API compat), and when we adopted the package-based APICompat later on in 6.0 it didn't follow references which would be required to type-forward testing. That still doesn't explain how the Looking into how the typeforwards were missed by the tool. |
I see what happened. This was correct in https://www.nuget.org/packages/System.Security.AccessControl/6.0.0-preview.3.21201.4 through https://www.nuget.org/packages/System.Security.AccessControl/6.0.0-preview.5.21301.5, but then the package was removed from the build. It was later brought back in 56894f0 which included the hand-authored typeforwards but those were missing these types. Most likely because that was generated from the last stable assembly instead of the preview assembly that had the changes. Fix here is to simply add them to https://github.com/dotnet/runtime/blob/release/6.0/src/libraries/System.Security.AccessControl/ref/System.Security.AccessControl.net461.cs |
Thanks for submitting the quick fix, @ericstj.
While we get the next 6.0 servicing version released with the fix included, would it be a reasonable workaround suggestion for @viktorgobbi to temporarily target one of those preview packages to get unblocked? |
@carlossanlop Sure, that will work for me. I just changed |
) The AccessControl assembly is missing type forwards for Evidence and EvidenceBase on .NETFramework. Cannot use Evidence or EvidenceBase from a netstandard2.0 library and run on .NETFramework. Fixes #99447
The fix for this shipped in https://www.nuget.org/packages/System.Security.AccessControl/6.0.1 |
Description
I'm trying to build a class library that targets .net Standard 2.0 which requires
System.Security.Policy.Evidence
and some other types from theSystem.Security.Policy
namespace (it only needs to run on windows). I added the System.Security.Permissions nuget package to the class library project and it compiles as expected but when I try to unit test the library in a .net framework project (targeting net47) by passing aSystem.Security.Policy.Evidence
instance to a type from the class library the compilation fails with a:After some investigation I found out that the
System.Security.Permissions
assembly for .net standard 2.0 forwards theEvidence
type fromSystem.Security.AccessControl
and theSystem.Security.AccessControl
assembly for .net standard 2.0 contains a stub for theEvidence
type but theSystem.Security.AccessControl
assembly for .net framework does not contain a definition or forward theEvidence
type.I also saw that the
System.Security.Permissions
for .net framework would forwardEvidence
frommscorlib
(what I assume is correct).Other types like
System.Security.Policy.Publisher
seem to work with fine.Reproduction Steps
Create a class library project that targets .net Standard 2.0 and add the System.Security.Permissions nuget package and a class using the
System.Security.Policy.Evidence
.Create a 'NUnit test project' that targets .net framework 4.8 and add a project reference to the .net standard class library project and pass a
Evidence
instance to theClassUsingEvidence
in a test:Leads to compiler error:
Even when adding the System.Security.AccessControl or System.Security.Permissions packages to the unit test project the error persists.
Expected behavior
The solution should compile and the
System.Security.Policy.Evidence
type frommscorlib
should be used in the .net framework project.Actual behavior
The compilation fails with
when used in a .net framework project
Regression?
No response
Known Workarounds
No response
Configuration
Other information
I'm not sure if this is a bug in
System.Security.AccessControl
/System.Security.Permissions
packages or if I am using it wrongly.If this is not the right repository for this issue please let me know where I should report this, I couldn't anything better fitting.
The text was updated successfully, but these errors were encountered: