I am developing a com dll in vs2013. at present it is building as a debug configuration. I have a windows forms app to use in developing the dll, but can't seem to use the debugger to stingle step through the function calls in the dll. I have added the dll project to the windows project, added a reference to the dll (in the \x86\debug output folder), but still can't step into the code.
any help appreciated!
.NET ProgrammingC#
Last Comment
kaufmed
8/22/2022 - Mon
Mlanda T
Have you tried just using a normal Project Reference as opposed to referencing the output in the Debug output folder? Am assuming your Class Library project AND the Windows Forms projects are both in the same solution? ALSO... not that when you run the Windows Forms DLL, it is probably copying the DLL into it's own \bin folder.
james henderson
ASKER
ok, I removed the reference to the dll and added it as a project reference; both projects are in the same solution. I am still unable to step into the dll methods from the windows form. does it matter that the the dll is com visible?
Mlanda T
It doesn't matter that the code is com visible. When you access it through Windows Forms, it's not using COM. It just accesses your Class Library without using COM.
1.
Are you targeting the same .NET framework version? Make sure you are targeting the same .NET version.
2.
Instead of using the typical F5 (or Start) button to debug things, rather start the *.exe for the test WinForms application that loads your DLL and then attach to it from Visual Studio (Debug -> Attach to Process...)
Do you get any error messages in the Output window?
kaufmed
Do you have .pdb files for the referenced assembly in your "bin" folder? These files are required by VS in order to debug your code.
james henderson
ASKER
MLandaT - I don't understand your suggestion. do I leave both projects in the same solution? the dll is not a running process, so I'm sure how to attach to it.
for all - yes, the .pdb file is in the bin\debug folder.
You leave them in the same solution. You do not attach to the DLL, but you run the EXE (winforms project ... compile, navitage to the bin folder, double click the EXE there) and attach to that EXE.
james henderson
ASKER
ok, I put a break point in the dll code and attach to the exe: but the breakpoint isn't hit in the dll ... ?
james henderson
ASKER
btw, I also pointed the output folder of the dll to the output folder of the exe. I also set the exe to be the start up program for the dll in the dll project properties.
Try a Clean and Rebuild. If that doesn't work, then examine your breakpoints while the application is running. Are they solid or hollowed out? If hollowed out, what is the message you see if you mouse over the breakpoint (dot)?
Assuming you've already added the project reference as suggested above, try a Rebuild (not Build) of each individual project separately. Then re-run the application. Do you observe the same behavior?
james henderson
ASKER
same thing. I did a rebuild of each project. the breakpoint in the dll code says there are no symbols loaded.
Mlanda T
What version of .NET is the Class Library targetting? Make sure you are targetting the same .NET version in both projects. This is set independently for each project.