SOLIDWORKS PDM API UnlockFile(s)

When developing an application with newer versions of .NET, it’s always a bit risky as the recommendation from SOLIDWORKS is to use the highest version of .NET Framework. I’m working on a more modern application, which I currently have targeting .NET 10, which has been great for everything so far, except when I was testing my check-in logic from either, IEdmFile5.UnlockFile or IEdmBatchUnlock2.UnlockFiles would result in a hard crash, non catchable exception.

Faulting module name: ntdll.dll, version: 10.0.26100.8246, time stamp: 0xf7576e9e
Exception code: 0xc0000409
Fault offset: 0x0000000000120fc6

My process to figure this out was to ask the almighty chat bots with no success. I figured that there was something out there that was an edge case from something totally unrelated that would solve all the world’s problems, but yet they still remain. Next I tested the same code in a .NET 10 console app, same crash. On to something that works- .NET Framework 4.8- which validated the code was correct and there was something else at play here. After a few minutes of going back and forth with a .NET console app, I found that the highest version that doesn’t crash is .NET 8.

I will update if I find anything else that prevents me from using .NET 8, but for now, let’s just say that it works as intended and is compatible with the rest of my project.