kellyethridge / VBCorLib

The VBCorLib framework brings many of the powerful .NET classes to VB6.
http://www.kellyethridge.com/vbcorlib/
MIT License
112 stars 28 forks source link

APPCRASH on Windows Server after app exit if CryptoConfig.CreateFromName() used #103

Open wardjk opened 2 years ago

wardjk commented 2 years ago

I'm submitting a bug report

Library Version: 3.2.0

Please tell us about your environment:

Operating System: Microsoft Windows Server 2012 R2 Standard

Current behavior: If SymmetricAlgorithm is instantiated with CryptoConfig.CreateFromName("Rijndael"), the OS indicates that the app stopped working upon normal app exit. One fault indicated as APPCRASH occurs with ntdll.dll: image Upon acknowledging the first fault, another subsequent fault occurs with MSVBVM60.DLL: image

Sample Source Code: VBCorLibDebug.vbp.txt modMain.bas.txt

Excerpt from modMain.bas:

Sub Main()
    Dim oCryptoProvider As CorLib.SymmetricAlgorithm
    Dim Ret As Integer

    MsgBox "Sub Main()"
    Ret = MsgBox("Do you want to crash after program exits?", vbYesNo)
    If Ret = vbYes Then
        Set oCryptoProvider = CryptoConfig.CreateFromName("Rijndael")
    End If
    If Not oCryptoProvider Is Nothing Then
        oCryptoProvider.Clear 'This doesn't help avoid crash
        Set oCryptoProvider = Nothing
    End If
    MsgBox "End"
End Sub

This is all that's needed to reproduce the problem on the problematic OS. The problem doesn't occur on Windows 10.

kellyethridge commented 2 years ago

Using your code, unfortunately, I cannot reproduce this on Windows Server 2012R2.

wardjk commented 2 years ago

It was found that if the application that uses VBCorLib is run in no later than Windows XP Compatibility mode then APPCRASH doesn't occur but this workaround can't be used because the app launches another app that cannot be run in Compatibility mode. I'm trying to narrow down what may be causing the APPCRASH problem by compiling test DLLs based on the 3.2.0 code.