Application crash, event viewer shows nvd3dumx_cfg.dll fault

Hi all,
I have a dll I wrote in CPP which uses SDL, and I import that dll into a C# application.
When I change levels, something that involved in assets freeing and allocating, I sometimes get a crash that have the following event in events viewer:

Faulting application name: Synosius.exe, version:, time stamp: 0x5ee99cfc
Faulting module name: **nvd3dumx_cfg.dll,** version:, time stamp: 0x5d9518c5
Exception code: 0xc0000409
Fault offset: 0x00000000009e8cf6
Faulting process id: 0xba8
Faulting application start time: 0x01d6684179a25eb2
Faulting application path: C:\Projects\Synosius\bin\x64\Debug\netcoreapp3.1\Synosius.exe
Faulting module path: C:\WINDOWS\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_db678424d2641c3d\nvd3dumx_cfg.dll
Report Id: 6b251a33-22f6-4d55-bbf2-4e5e2c196ee1
Faulting package full name: 
Faulting package-relative application ID: 

I think it may be related to the fact that what’s triggers texture destruction from C# side is the garbage collector which can happen at random times (the C# objects destructor calls a method on CPP side to free textures I no longer use).

Anyone ever got this crash and can give tips on how to debug this? Can’t directly debug because of the C# <–> C++ transition and it crash without exception.


Update: didn’t find the source of the issue but solved by adding all assets and textures that needs to be freed into a temporary vector and actually releasing them only at the end of every frame, when I know SDL is not doing anything like rendering.

So the problem is probably when trying to free texture while rendering or flipping backbuffer or something like that.