Skip to content

SaveCurrentExceptionInfo fails in an UWP app using interop with minimum target higher than 15063 #47382

Closed
@JohannesKauffmann

Description

@JohannesKauffmann

Description

I am developing an UWP app which uses libvlc interop via the LibVLCSharp (bindings) and LibVLC.UWP (native code) nuget packages. In debug x86 configuration (with and without debugger attached), an unhandled win32 exception occurs on startup in coreclr.dll. The last stack frame points to CheckThreadStateNoCreate, see below for details. It does not occur on release mode at all, and x64 also works fine. The "fix" is to set the minimum target version of the app to 15063 or to downgrade the LibVLC.UWP nuget package. See also here.

The crash can be reproduced by cloning this project, selecting x86 debug configuration and upgrading the minimum target version to 16299 or beyond.

Configuration

Running Windows 10 Education 1909 x64. Visual Studio 2019 is 16.8.3. The UniversalWindowsPlatform nuget package is version 6.2.11.

Regression?

With the minimum target version on 15063, everything works as expected. Anything above that fails.

Other information

Since I couldn't get windbg to attach to the UWP sample app before it crashes, I used another app to get a dump. Since the issue arises on startup in the corecrl, the stack trace should be the same. Below is the exception analysis.

*******************************************************************************
*                                                                             *
*                        Exception Analysis                                   *
*                                                                             *
*******************************************************************************

*** WARNING: Unable to verify checksum for libvlccore.dll
*** WARNING: Unable to verify checksum for libvlc.dll
Failed to request MethodData, not in JIT code range

KEY_VALUES_STRING: 1

    Key  : AV.Dereference
    Value: NullClassPtr

    Key  : AV.Fault
    Value: Read

    Key  : Analysis.CPU.Sec
    Value: 20

    Key  : Analysis.DebugAnalysisProvider.CPP
    Value: Create: 8007007e on JOHANNESMD

    Key  : Analysis.DebugData
    Value: CreateObject

    Key  : Analysis.DebugModel
    Value: CreateObject

    Key  : Analysis.Elapsed.Sec
    Value: 139

    Key  : Analysis.Memory.CommitPeak.Mb
    Value: 382

    Key  : Analysis.System
    Value: CreateObject

    Key  : CLR.Engine
    Value: CORECLR

    Key  : CLR.Version
    Value: 4.6.27902.3

    Key  : Timeline.OS.Boot.DeltaSec
    Value: 74415

    Key  : Timeline.Process.Start.DeltaSec
    Value: 749


NTGLOBALFLAG:  0

PROCESS_BAM_CURRENT_THROTTLED: 0

PROCESS_BAM_PREVIOUS_THROTTLED: 0

APPLICATION_VERIFIER_FLAGS:  0

CONTEXT:  (.ecxr)
eax=00000000 ebx=00000000 ecx=00000005 edx=0384f588 esi=0384f538 edi=0384f588
eip=7b77767a esp=0384f3ec ebp=0384f43c iopl=0         nv up ei pl zr na pe nc
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00010246
coreclr!CExecutionEngine::GetTlsData+0xc [inlined in coreclr!CExecutionEngine::CheckThreadStateNoCreate+0xc]:
7b77767a 8b0488          mov     eax,dword ptr [eax+ecx*4] ds:002b:00000014=????????
Resetting default scope

EXCEPTION_RECORD:  0384f538 -- (.exr 0x384f538)
ExceptionAddress: 774336e4 (ntdll!LdrpReportError+0x000394dd)
   ExceptionCode: c0000139
  ExceptionFlags: 00000001
NumberParameters: 0

PROCESS_NAME:  OneDrive-Cloud-Player.exe

READ_ADDRESS:  00000014 

ERROR_CODE: (NTSTATUS) 0xc0000005 - De instructie op 0x%p verwijst naar geheugen op 0x%p. Het geheugen kan niet worden %s.

EXCEPTION_CODE_STR:  c0000005

EXCEPTION_PARAMETER1:  00000000

EXCEPTION_PARAMETER2:  00000014

FAULTING_THREAD:  ffffffff

STACK_TEXT:  
0384f3e8 7b77762c 0384f458 7b7772e0 7b77724c coreclr!CExecutionEngine::CheckThreadStateNoCreate+0xc
0384f3f4 7b77724c 45f46985 774b132c 00000000 coreclr!SaveCurrentExceptionInfo+0x11
0384f43c 773fcf26 0384f458 0384f588 0384f538 coreclr!CLRVectoredExceptionHandlerShim+0xac
0384f48c 773f8e8b 00000000 00000000 c0000139 ntdll!RtlpCallVectoredHandlers+0xd5
0384f520 774053c6 0384f538 0384f588 0384f538 ntdll!RtlDispatchException+0x6f
0384f520 774336e4 0384f538 0384f588 0384f538 ntdll!KiUserExceptionDispatcher+0x26
0384fbcc 77427734 c0000139 8e0245fe 774adc20 ntdll!LdrpReportError+0x394dd
0384fc78 773d946b 773d943e 00000000 773d946b ntdll!LdrpSnapModule+0x4f214
0384fcd4 773c9b09 773c9ab0 032060c0 03209338 ntdll!LdrpProcessWork+0x4d
0384fce4 773c9a1d 0384fdf4 00000000 032060c0 ntdll!LdrpWorkCallback+0x59
0384fd18 773c868c 0384fdf4 03206138 8e02474e ntdll!TppWorkpExecuteCallback+0x1dd
0384fec8 76bc6359 03205f30 76bc6340 0384ff34 ntdll!TppWorkerThread+0x72c
0384fed8 773f8944 03205f30 8e0246b2 00000000 kernel32!BaseThreadInitThunk+0x19
0384ff34 773f8914 ffffffff 7741a0da 00000000 ntdll!__RtlUserThreadStart+0x2f
0384ff44 00000000 773c7f60 03205f30 00000000 ntdll!_RtlUserThreadStart+0x1b


FAULTING_SOURCE_LINE:  e:\a\_work\414\s\src\vm\corhost.cpp

FAULTING_SOURCE_FILE:  e:\a\_work\414\s\src\vm\corhost.cpp

FAULTING_SOURCE_LINE_NUMBER:  3305

SYMBOL_NAME:  coreclr!CExecutionEngine::CheckThreadStateNoCreate+c

MODULE_NAME: coreclr

IMAGE_NAME:  coreclr.dll

STACK_COMMAND:  .cxr 384f588 ; kb ; ~2s ; .ecxr ; kb

FAILURE_BUCKET_ID:  NULL_CLASS_PTR_READ_c0000005_coreclr.dll!CExecutionEngine::CheckThreadStateNoCreate

BUCKET_ID_MODPRIVATE: 1

OS_VERSION:  10.0.18362.1

BUILDLAB_STR:  19h1_release

OSPLATFORM_TYPE:  x86

OSNAME:  Windows 10

FAILURE_ID_HASH:  {75b5e358-0cc2-f350-e8df-c0a10e1269f1}

Followup:     MachineOwner
---------

This issue looked similar, so I tried it on a Windows 10 machine build 2004 with the minimum and target versions set to the highest possible in hope it was fixed, but to no avail.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions