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

Crash using System.Security.Cryptography.ECDsa after app domain recycle #958

Open
eglasius opened this issue Feb 6, 2019 · 0 comments

Comments

@eglasius
Copy link

commented Feb 6, 2019

The problem: there are some environments where the fix announced here is not working correctly:

Address a situation where the System.Security.Cryptography.Algorithms reference was not correctly loaded on .NET Framework 4.7.1 after the 7B/8B patch. [673870]

Scenario:
An asp.net website targetting .net 4.7.1 has a page that uses a method of a .net standard 2 library like this one:

        var ecdsa = ECDsa.Create();
        ecdsa.GenerateKey(ECCurve.NamedCurves.brainpoolP160r1);

The type is important as not all types that are type forwarded in System.Security.Cryptography.Algorithms are affected.

The asp.net site has the 12 binding redirects the Visual Studio tooling offers to apply from the build warning + the corresponding assemblies are in the bin folder.

I have attached a solution with the above. Following these steps reproduces the crash:

  1. load the default page
  2. update the web.config to cause the recycle (i.e. adding a space)
  3. load the default page again.

The following entry gets logged in the event viewer:

	Faulting application name: w3wp.exe, version: 10.0.16299.15, time stamp: 0x0aeb5595
	Faulting module name: clr.dll, version: 4.7.3130.0, time stamp: 0x5b175fed
	Exception code: 0xc0000005
	Fault offset: 0x0000000000157b7f
	Faulting process id: 0x690
	Faulting application start time: 0x01d4b8882bba796c
	Faulting application path: c:\windows\system32\inetsrv\w3wp.exe
	Faulting module path: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
	Report Id: b76f99a8-7b45-41ba-bb58-f288356a0980
	Faulting package full name: 
	Faulting package-relative application ID: 

Along with an extra entry:

	Application: w3wp.exe
	Framework Version: v4.0.30319
	Description: The process was terminated due to an internal error in the .NET Runtime at IP 00007FFB418F7B7F (00007FFB417A0000) with exit code 80131506.

Attaching to the process shows that an ExecutionEngineException is thrown when the steps are followed leading to the crash.

This is known to relate to #811, but the problem is we see 3 types of environments:

  1. Environments where the issue reproduces and applying the Microsoft fixes via Windows Update solves the issue.
  2. Environments where the updates is applied and still get the crash.
    1 We had trouble trying the uninstall-install as someone had to do here: #811 (comment)
    2 Note that re-applying updates is quite painful, because one needs to uninstall the intermediate updates to get to the July one and between each one you have associated restarts.
    3 We could not figure out what difference in environments causes this, since we had it in environments running the very same windows 10 version + update level. Note these development environments might not get windows updates, visual studio updates in different order, but we were not sure what to look for.
  3. Environments where we cannot reproduce the issue, regardless of not having the later Windows Update with the fix.
    IsolatedRepro 3.zip

Known work around: update the binding redirect to point to 4.0.0.0 instead of 4.3.0.0 of System.Security.Cryptography.Algorithsm. However, we could not find clear information on how that would affect .net standard 2 compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.