Debugging an external DLL in .NET.

I am late linking my project to a DLL file and throwing an exception to the DLL method call. This method is also used in another project (which is early DLL binding) and it works great.

Is there a way to debug code inside a method from this new project to see what is wrong?

I created this DLL and obviously had all the source code.

Both DLL files encoded using Visual Basic 2003 and .NET 1.1.

+4
source share
3 answers

I assume that your native DLL is written in C ++, your .NET host is written in C #, and you used Visual Studio since you did not provide the information.

In this case, you can open your DLL project in Visual Studio and use Attach to Process in the Debug menu to debug your instance of your host application. Alternatively, you can set the project to run the application when starting from the DLL project.

I would suggest that you can also go and land at breakpoints if you started debugging from a .NET application, but I never did.

+4
source

You can debug the DLL - when you press F5 , you will be asked about the EXE file - just view your executable file and start debugging.

If your DLL file uses some other library or DLL file, all its dependencies should be in the path where they can be found. Perhaps you just did not copy all the dependencies along with your DLL file.

+2
source

If the running process has debug files (.pdb files) for the loaded DLL files, you can open the project for the corresponding DLL and attach it to the running process (Debug → Attach To Process).

+1
source

Source: https://habr.com/ru/post/1333495/


All Articles