Skip to content

Add throwing PNSE to System.Security.Cryptography on WASM - #38379

Merged
akoeplinger merged 3 commits into
dotnet:masterfrom
MaximLipnin:wasm_crypto_tests
Jun 29, 2020
Merged

akoeplinger merged 3 commits into
dotnet:masterfrom
MaximLipnin:wasm_crypto_tests

Conversation

@MaximLipnin

Copy link
Copy Markdown
Contributor

Since the entire set of System.Security.Cryptography.* tests has been disabled on WASM recently in #37723, we need to let everyone know that those areas are not quite supported on WASM at the moment. In that case System.Security.Cryptography classes could throw PlatformNotSupportedException until some solution comes (#37669)

cc @steveisok

@ghost

ghost commented Jun 25, 2020

Copy link
Copy Markdown

Tagging subscribers to this area: @bartonjs, @vcsjones, @krwq
Notify danmosemsft if you want to be subscribed.

@MaximLipnin
MaximLipnin requested review from akoeplinger and vargaz and removed request for akoeplinger June 25, 2020 10:10
@steveisok

Copy link
Copy Markdown
Member

@MaximLipnin Since the set of assemblies are going to be PNSE, you can use something like this:

<PropertyGroup>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetsBrowser)' == 'true'">SR.FileSystemWatcher_PlatformNotSupported</GeneratePlatformNotSupportedAssemblyMessage>
</PropertyGroup>
<ItemGroup Condition="'$(TargetsBrowser)' != 'true'">

@akoeplinger

Copy link
Copy Markdown
Member

@steveisok I just noticed that using the PNSE generator would also generate it for RandomNumberGenerator which we've identified is used in a bunch of places. Either we fix those to not rely on it, or we need to do manual PNSE.

@MaximLipnin

Copy link
Copy Markdown
Contributor Author

Could GeneratePlatformNotSupportedAdditionalParameters be helpful in this case? https://github.com/ericstj/arcade/blob/master/src/Microsoft.DotNet.GenAPI/build/Microsoft.DotNet.GenAPI.targets#L106

@steveisok

Copy link
Copy Markdown
Member

ah, good point. @MaximLipnin I don't know. When I looked earlier it seemed all or nothing.

@MaximLipnin MaximLipnin changed the title [WIP] Add throwing PNSE to System.Security.Cryptography on WASM Add throwing PNSE to System.Security.Cryptography on WASM Jun 29, 2020
@MaximLipnin
MaximLipnin marked this pull request as ready for review June 29, 2020 11:48
@marek-safar
marek-safar requested a review from bartonjs June 29, 2020 14:57
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetsBrowser)' == 'true'">SR.Cryptography_PlatformNotSupported_Browser</GeneratePlatformNotSupportedAssemblyMessage>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The two OS functions that this library uses are:

  • Tell me what the friendly name of this OID is (Windows, Linux)
  • Pretty print this identified item (Windows, Linux)

macOS has no OS fallbacks, it just uses managed implementations with limited string support; so Browser could just build with the "OSX" flavor.

That said, there's not a whole lot I'd expect anyone to do with this assembly without the rest of crypto, so maybe PNSE is best for now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think PNSE is better for now.

<AssemblyVersion Condition="'$(TargetFramework)' == 'netstandard2.0'">4.1.0.0</AssemblyVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetsUnix)' != 'true'">
<PropertyGroup Condition="'$(TargetsUnix)' != 'true' or '$(TargetsBrowser)' == 'true'">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does the browser target claim to be Unix? If not, the or seems redundant.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It does right now, but that will be changed with #37944. For now this is needed.

@bartonjs bartonjs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Assuming TargetsBrowser does not imply TargetsUnix, it'd be good to get the redundant "or" cleaned up, otherwise LGTM.

<AssemblyVersion Condition="'$(TargetFramework)' == 'netstandard2.0'">4.1.0.0</AssemblyVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetsUnix)' != 'true'">
<PropertyGroup Condition="'$(TargetsUnix)' != 'true' or '$(TargetsBrowser)' == 'true'">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It does right now, but that will be changed with #37944. For now this is needed.

<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetsBrowser)' == 'true'">SR.Cryptography_PlatformNotSupported_Browser</GeneratePlatformNotSupportedAssemblyMessage>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think PNSE is better for now.

@akoeplinger
akoeplinger merged commit 522d73e into dotnet:master Jun 29, 2020
@MaximLipnin
MaximLipnin deleted the wasm_crypto_tests branch June 30, 2020 05:51
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants