Stepping Through Code in a DLL

G

Guest

I'm developing a C# WinForms app. My main EXE is referencing a DLL that I
call "DataObjects.dll".

I'm trying to step through each line of code to track down a bug. When a
call is made to a method in the DLL, the code executes but it does not let me
step through the code in the method.

I KNOW it used to let me do this!

So I cleared out all the files from the bin and obj folders of both the DLL
and the EXE. Yet this didn't resolve the problem.

Why did this happen and how do I fix it?
 
P

Paul E Collins

Robert said:
When a call is made to a method in the DLL, the
code executes but it does not let me step through
the code in the method.

You did build the solution in Debug and not Release mode, right?

Eq.
 
G

Guest

Yes, it's built in Debug mode. And I've Rebuilt it several times. But
still, when I try step through it, it won't let me step through the code in
the DLL's method.

Has this not happened to anyone else before?
 
G

Guest

Your "Main EXE" project needs to have a PROJECT REFERENCE to the project that
builds the Assembly (DLL), not a direct reference to the build assembly dll.
Peter
 
N

Nicholas Paldino [.NET/C# MVP]

Robert,

Are you referencing a project, or are you referencing the DLL? You need
to reference the project, and not the dll itself in order to be able to step
through.

Hope this helps.
 
G

Guest

Dear Peter,

I thought I had done that (as you described) but just to be sure, I removed
all references and re-established them as per your instructions. This
corrected the problem! Strange that it didn't work before.

While we're on the topic of references, maybe you could help me with a
nagging reference error that I've had for some time. It's shown in the
warning message here:

Warning: The dependency 'DataObjects, Version=1.0.2340.19611,
Culture=neutral' in project 'Desktop' cannot be copied to the run directory
because it would overwrite the reference 'DataObjects,
Version=1.0.2341.26251, Culture=neutral'.

I understand that it won't overwrite a newer version but the fact is that
DataObjects is being rebuilt whenever I rebuild Desktop, so why is this
happening?


--
Robert W.
Vancouver, BC
www.mwtech.com
 
G

Guest

Robert,
this is very common, because the default settings for build numbering in the
AssemblyInfo.cs file is 1.0.*.*.
Change this to a hard-coded number such as 1.0.0.0 and now you control it.
Delete the Assembly DLL that refuses to be overwritten and after you've done
that, the problem will go away.

-- Peter
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
 
G

Guest

Peter,

I'm aware of how the last part of the version number is created - a
mathematical expression of date & time. And based on that, I don't
understand why the numbers don't keep on increasing.

Another Microsoft mystery?

--
Robert W.
Vancouver, BC
www.mwtech.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top