Skip to content

[.NET 5 RC2 Regression] HashAlgorithm.ComputeHash is unsupported on 'browser' #26879

Closed
@SommerEngineering

Description

@SommerEngineering

Describe the bug

In .NET 5 RC1 the hash algorithms were not included, cf. dotnet/runtime#42625. This has been fixed (dotnet/runtime#42267): In .NET 5 RC2 we can use hash algorithms again, e.g. to hash the user passwords on the client side. However, the compiler issues a warning, which is a false positive kind of error:

Login.razor.cs(140,28): warning CA1416: 'HashAlgorithm.ComputeHash(byte[])' is unsupported on 'browser'

I assume that this is an error in the "Browser platform compatibility tooling".

To Reproduce

Use the following code in Blazor:

using SHA512 sha512 = new SHA512Managed();
var data = sha512.ComputeHash(Encoding.UTF8.GetBytes("password"));

Then, dotnet build will show the warning but the code works fine, though.

Further technical details

.NET SDK (reflecting any global.json):
Version: 5.0.100-rc.2.20479.15
Commit: da7dfa8840

Runtime Environment:
OS Name: Windows
OS Version: 10.0.17763
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.100-rc.2.20479.15\

Host (useful for support):
Version: 5.0.0-rc.2.20475.5
Commit: c5a3f49c88

.NET SDKs installed:
3.1.202 [C:\Program Files\dotnet\sdk]
3.1.402 [C:\Program Files\dotnet\sdk]
5.0.100-rc.2.20479.15 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-rc.2.20475.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0-rc.2.20475.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0-rc.2.20475.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions