开发者

Debugging external DLL in .NET

开发者 https://www.devze.com 2023-02-01 22:17 出处:网络
I\'m late binding my project to a DLL file and it is throwing an exception in a call to a DLL\'s method. This method is also used in another project (that is early binding to the DLL) and it works bea

I'm late binding my project to a DLL file and it is throwing an exception in a call to a DLL's method. This method is also used in another project (that is early binding to the DLL) and it works beautifully.

Is there a way I can debug the code within the method, from this new project, t开发者_JAVA技巧o see what's wrong?

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

Both DLL files where coded using Visual Basic 2003 and .NET 1.1.


I'm guessing that your native DLL is written in C++, your .NET host is written in C# and you used Visual Studio, since you didn't provide the information.

In this case you can open up your DLL project in Visual Studio and use the Attach to Process action on the Debug menu to debug an already running instance of your host application. Alternatively, you can set the project up to start the app when you Run from within the DLL project.

I would imagine that you could also step through and land on breakpoints if you started out debugging from the .NET host application, but I've never done that.


You can debug the DLL - when you press F5, you'll be asked for the EXE file - just browse to your executable and debugging can be started.

If your DLL file use some other library or DLL file - all its dependencies have to be in the path where they can be found. Maybe you just didn't copy all of dependencies together with your DLL file.


If the running process has the debug symbols (.pdb files) for its loaded DLLs available, you can open the project for the DLL in question and attach it to the running process (Debug -> Attach To Process).

0

精彩评论

暂无评论...
验证码 换一张
取 消