Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, September 12, 2017 2:48 PM | 1 vote
Currently I have solution A that contains definition of the function and solution B that references the dll using DllImport from solution A. Is there a way to debug straight through from one to the other with two instances of visual studio open (one for each solution).
Example:
Solution A:
[DllImport("proj", CharSet = CharSet.Unicode)]
public static extern int function(int a, int b);
Solution B:
int function (int a, int b)
{
...
...
}
All replies (3)
Tuesday, September 12, 2017 4:56 PM | 1 vote
Have you tried to add the second project to Solution A, or to a copy of Solution A? (A project can be added to multiple solutions).
Also consider setting the “Enable native code debugging” option for the first project.
Wednesday, September 13, 2017 1:37 AM | 1 vote
People should not say "DLL" without saying what type of DLL it is. There are many types of DLLs. Since you are using DllImport the implication is that the DLL is not a managed DLL. So you should also provide information about where it comes from. If it is a third-party DLL then you probably don't have a debug build of it. The fact that it is a separate project is not likely a problem if you are using a debug build of the DLL.
I have had to debug two projects where they were separate processes. Separate instances of VS might be needed for separate processes but a DLL being called from an exec is not separate process.
Sam Hobbs
SimpleSamples.Info
Thursday, September 21, 2017 6:20 AM
Hi Shiva,
"You can only have one debugger debugging a process at once. So that means you only need one instance of Visual Studio open.
However, you can just open the .cpp/.cs/whatever file from Solution B into Solution A's copy of Visual Studio and set breakpoints. It'll still work even though those files aren't actually part of the solution."
Reference thread:
https://stackoverflow.com/questions/2436237/debugging-through-different-solutions-in-visual-studio
Best regards,
Fletcher
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected].