Avatar of james henderson
james henderson
Flag for United States of America asked on

dll development in visual studio 2013

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#

Avatar of undefined
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...)
Your help has saved me hundreds of hours of internet surfing.
fblack61
Mlanda T

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.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Mlanda T

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.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
kaufmed

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)?
ASKER CERTIFIED SOLUTION
Mlanda T

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
james henderson

ASKER
the breakpoint in the dll says it won't be hit because no symbols have been loaded.
james henderson

ASKER
the .dll, .pdb, and .tlb files are all in the same folder as the .exe that is calling it.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
kaufmed

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.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
SOLUTION
kaufmed

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.