I have a C# COM Interop DLL that calls a web service. (This DLL is used from native C code - it was easier to access the web service in C# than in C .) This DLL was originally written for .NET 1, but has been updated to .NET 4, and was working in .NET 4.
Recently, the DLL has stopped working correctly, so I'm trying to debug it, but the breakpoints are not working. I'm using VS2019, and the debug options are set to run my C program to access the DLL.
Originally, the breakpoints could be set in the C# functions, but as soon as I start the debug session, the breakpoints would disable. I googled it, and found reference to a few project settings that could cause this, and tried a few things, to no avail. Then I re-built the project, using the "Class Library (.NET Framework)" template. Now, the breakpoint will stay active, until the app calls the function with the breakpoint, and THEN the breakpoint disables. It's obviously recognising the breakpoint, but then disabling it instead of stopping.
Any suggestions?
CodePudding user response:
Shot in the dark answer. In the project settings for the EXE you want to debug the DLL with, try changing the Debugger Type setting. (Project properties -> Debugging -> Debugger Type)
From what you describe, it smells like it's either on "auto" or on "Native Only". Assuming you don't need breakpoints in the C code, you could try "Managed Only" if the "Mixed" option doesn't reliably work.
CodePudding user response:
To debug DLL projects in Visual Studio IDE, follow the guidelines I've shared below:
- How To Debug From A DLL Project?
- Debugging DLL Projects
- Project Settings For A C Debug Configuration
Update the Microsoft.VisualStudio.Debugger.Interop.10.0 package just in case.
Note: I gave a general answer as it is a general question. I can do my best if the detail level of the error is reached.