View Single Post
Old 2nd January 2020, 14:38   #8  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
Instead of the .NET Framework CLR I tried the much more advanced .NET Core CLR and that doesn't run the slow function but throws:

System.ExecutionEngineException: 'Exception of type 'System.ExecutionEngineException' was thrown.'


edit:

with native code debugging enabled:

Exception thrown at 0x00007FF80C2C2EE8 (coreclr.dll) in cs console.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.


edit2:

difference is the fast variant calls AddRef in the QueryInterface method.


edit3:

the solution:

Code:
    __declspec(dllexport) LPVOID __stdcall
    CreateBasicServerSlow()
    {
        auto value = new BasicServer();
        value->AddRef();
        return value;
    }

Last edited by stax76; 2nd January 2020 at 15:02.
stax76 is offline   Reply With Quote