Skip to content
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

Fix packaging for the browser #40814

Merged
merged 3 commits into from
Aug 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<WarningsNotAsErrors>CS0618</WarningsNotAsErrors>
<DefineConstants Condition="'$(TargetsWindows)' == 'true'">$(DefineConstants);FEATURE_WINDOWS_SYSTEM_COLORS;FEATURE_SYSTEM_EVENTS</DefineConstants>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<TargetFrameworks>$(NetCoreAppCurrent)-Windows_NT;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser;netcoreapp3.0-Windows_NT;netcoreapp3.0-Unix</TargetFrameworks>
<TargetFrameworks>$(NetCoreAppCurrent)-Windows_NT;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent);netcoreapp3.0-Windows_NT;netcoreapp3.0-Unix;netcoreapp3.0</TargetFrameworks>
Copy link
Member

Choose a reason for hiding this comment

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

Why are we adding netcoreappp3.0 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We want anybody using system.Drawing.common package on browser to have pnse, which is not the case currently. net5.0 is not included in the package, only netcoreapp3.0-win & netcoreapp3.0-unix.

Adding a version less config netcoreapp3.0 will have pnse for browser or any other os not a child of windows & unix.

Copy link
Member

Choose a reason for hiding this comment

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

net5.0 is not included in the package

That's the part I was missing. Thanks.

Copy link
Member

Choose a reason for hiding this comment

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

Before this would have resolved to the netstandard2.0 lib which is harvested, but presumably that was a ref-def mismatch because it was lower version than the 3.0 ref?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes thats a correct. The 3.0 contains some api changes which are not in netstandard2.0

<ExcludeCurrentNetCoreAppFromPackage>true</ExcludeCurrentNetCoreAppFromPackage>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetsBrowser)' == 'true'">SR.SystemDrawingCommon_PlatformNotSupported</GeneratePlatformNotSupportedAssemblyMessage>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetsAnyOS)' == 'true'">SR.SystemDrawingCommon_PlatformNotSupported</GeneratePlatformNotSupportedAssemblyMessage>
</PropertyGroup>
<ItemGroup Condition="'$(TargetsBrowser)' != 'true'">
<ItemGroup Condition="'$(TargetsAnyOS)' != 'true'">
<Compile Include="System\Drawing\Bitmap.cs" />
<Compile Include="System\Drawing\BitmapSuffixInSameAssemblyAttribute.cs" />
<Compile Include="System\Drawing\BitmapSuffixInSatelliteAssemblyAttribute.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
the facades when the package is restored. -->
<PackageTargetFramework Condition="$(TargetFramework.StartsWith('net4'))">net461</PackageTargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetsUnix)' != 'true' or '$(TargetsBrowser)' == 'true'">
<PropertyGroup Condition="'$(TargetsUnix)' != 'true'">
eerhardt marked this conversation as resolved.
Show resolved Hide resolved
<GeneratePlatformNotSupportedAssemblyMessage>SR.PlatformNotSupported_CryptographyOpenSSL</GeneratePlatformNotSupportedAssemblyMessage>
<!-- Clear PackageTargetRuntime on Windows to package the PlatformNotSupported assembly
without a RID so that it applies in desktop packages.config projects as well -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,4 @@
<data name="Cryptography_Cms_CertificateAlreadyInCollection" xml:space="preserve">
<value>Certificate already present in the collection.</value>
</data>
<data name="SystemSecurityCryptographyPkcs_PlatformNotSupported" xml:space="preserve">
<value>System.Security.Cryptography.Pkcs is not supported on this platform.</value>
</data>
</root>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<OmitResources Condition="$(TargetFramework.StartsWith('net4'))">true</OmitResources>
<!-- Currently the netstandard build is locked to the net472 API -->
<AssemblyVersion Condition="$(TargetFramework.StartsWith('netstandard'))">4.0.4.0</AssemblyVersion>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetsBrowser)' == 'true'">SR.SystemSecurityCryptographyPkcs_PlatformNotSupported</GeneratePlatformNotSupportedAssemblyMessage>
Copy link
Member

Choose a reason for hiding this comment

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

Same as above - Crypto doesn't work on Browser, so we should be generating PNSE.

If we are really removing this - then we should also remove the SystemSecurityCryptographyPkcs_PlatformNotSupported string from the Strings.resx.

Copy link
Contributor Author

@Anipik Anipik Aug 14, 2020

Choose a reason for hiding this comment

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

'$(TargetsBrowser)' == 'true' will never be true as the current tfms doesnt target browser specific config

If we want to add pnse for crypto here, we need to add a new tfm.

cc @marek-safar

Copy link
Member

Choose a reason for hiding this comment

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

cc @lewing and @steveisok as well - since they are working on adding [UnsupportedOSPlatform] attributes for browser.

Copy link
Member

Choose a reason for hiding this comment

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

Also note that we have ExcludeCurrentNetCoreAppFromPackage so if we add NetCoreAppCurrent-Browser we need to include current tfm in the package.

Copy link
Member

Choose a reason for hiding this comment

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

I take it we would no longer be throwing PNSE out of here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there something that we need to do in this pr ?

Copy link
Contributor

Choose a reason for hiding this comment

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

When running System.Security.Cryptography.Pkcs.Tests library test suite on Browser Wasm, there is the following result:
Tests run: 813, Errors: 0, Failures: 728, Skipped: 19. Time: 2.13732s.
Most of the failures are System.PlatformNotSupportedException : System.Security.Cryptography.Encoding is not supported on this platform. and System.PlatformNotSupportedException : System.Security.Cryptography.Algorithms is not supported on this platform.

Copy link
Member

Choose a reason for hiding this comment

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

Is there something that we need to do in this pr ?

@Anipik I don't think so.

Copy link
Member

Choose a reason for hiding this comment

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

Is the SystemSecurityCryptographyPkcs_PlatformNotSupported resource still being used? If not can you delete it?

@steveisok - will these APIs get ‘UnsupportedOSPlatform(“browser”) attributes on them?

Copy link
Contributor

@MaximLipnin MaximLipnin Aug 18, 2020

Choose a reason for hiding this comment

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

They already have it- #40612

</PropertyGroup>
<Import Project="$(CommonPath)System\Security\Cryptography\Asn1\AsnXml.targets" Condition="'$(IsPartialFacadeAssembly)' != 'true'" />
<Import Project="$(CommonPath)System\Security\Cryptography\Asn1Reader\System.Security.Cryptography.Asn1Reader.Shared.projitems" Condition="'$(IsPartialFacadeAssembly)' != 'true'" />
Expand Down