473,484 Members | 1,613 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to debug a mixed assembly

I'm new to working with mixed assemblies. All of my previous experience has
been with VC++/MFC in native, unmanaged applications.

When I create a mixed assembly in which one or more of the files compiles
with /clr the instructions say that I need to change the switch for Debug
information format from Program Database for Edit & Continue to disabled.

At runtime I find that I am not able to set breakpoints in the managed code,
nor trace into it.

Is there someway to debug both the managed and unmanaged parts of a mixed
assembly?

Thanks,
Jim

Mar 7 '07 #1
7 4779
"Jim Walsh" <Ji******@discussions.microsoft.comwrote in message
news:FD**********************************@microsof t.com...
I'm new to working with mixed assemblies. All of my previous experience
has
been with VC++/MFC in native, unmanaged applications.

When I create a mixed assembly in which one or more of the files compiles
with /clr the instructions say that I need to change the switch for Debug
information format from Program Database for Edit & Continue to disabled.

At runtime I find that I am not able to set breakpoints in the managed
code,
nor trace into it.

Is there someway to debug both the managed and unmanaged parts of a mixed
assembly?
Are you using VS2003 or VS2005? Did you turn off the edit-and-continue
option but continue to generate the PDB file? Have you tried setting the
debugger type to "mixed" rather than "auto"?

Regards,
Will
www.ivrforbeginners.com
Mar 7 '07 #2
William,

Thanks for your quick reply to my posting.

1. I am using VS2005.

2. Debugger type is set to Auto - I will change this to mixed.

3. "Did you turn off the edit-and-continue option but continue to generate
the PDB file?" I don't know the answer to this question...I am new to managed
code.

Jim

"William DePalo [MVP VC++]" wrote:
"Jim Walsh" <Ji******@discussions.microsoft.comwrote in message
news:FD**********************************@microsof t.com...
I'm new to working with mixed assemblies. All of my previous experience
has
been with VC++/MFC in native, unmanaged applications.

When I create a mixed assembly in which one or more of the files compiles
with /clr the instructions say that I need to change the switch for Debug
information format from Program Database for Edit & Continue to disabled.

At runtime I find that I am not able to set breakpoints in the managed
code,
nor trace into it.

Is there someway to debug both the managed and unmanaged parts of a mixed
assembly?

Are you using VS2003 or VS2005? Did you turn off the edit-and-continue
option but continue to generate the PDB file? Have you tried setting the
debugger type to "mixed" rather than "auto"?

Regards,
Will
www.ivrforbeginners.com
Mar 7 '07 #3
"Jim Walsh" <Ji******@discussions.microsoft.comwrote in message
news:67**********************************@microsof t.com...
Thanks for your quick reply to my posting.
You are welcome.
1. I am using VS2005.
OK. I asked because 2003 sometimes has difficulty in "auto" debug mode. The
only mixed mode project I have is built with it and not 2005 so I don't know
if that has a bearing.
2. Debugger type is set to Auto - I will change this to mixed.
As long as you have a mixed-mode project I don't think it can hurt.
3. "Did you turn off the edit-and-continue option but continue to generate
the PDB file?" I don't know the answer to this question...I am new to
managed
code.
OK. Choose Properties from the Project Menu. Then in the left pane make sure
that the C++ options are expanded (click on the + sign if necessary). Select
the General item. In the right pane look for Debug Information Format.
Change to Program Database and rebuild your project.

Regards,
Will
www.ivrforbeginners.com
Mar 7 '07 #4
William,

At this point I have gotten thoroughly mixed up. Let me review:

I have two projects, one dependent on the other:

1. The first project is my Visual C++ program. I am compiling this project
as unmanaged, native, except for two modules. In the project properties, I
have set "No common Language Runtime support", Debug Information Format =
"Program Database for Edit & Continue (/ZI)", and Debugger Type = mixed.

There are two files in this project that I am compiling with /clr. For
these, I have set Debug Information Format = disabled. One of these files
uses a dialog class defined in the 2nd project.

2. The second project was created from the example in the MSDN Library
entitled "Hosting a Windows Form User Control in an MFC Dialog box". This is
a Visual C# Windows control library project. It creates a a Windows Form User
control that will be hosted in the MFC dialog box.

For this 2nd project, I have set Debugger type = Mixed, Debug Information
Format to Program database (/Zi), and Common Language Runtime support to
"Pure MSIL Common Languare runtime support (/clr:pure).

Are these settings correct?

Thanks,
Jim

"William DePalo [MVP VC++]" wrote:
"Jim Walsh" <Ji******@discussions.microsoft.comwrote in message
news:67**********************************@microsof t.com...
Thanks for your quick reply to my posting.

You are welcome.
1. I am using VS2005.

OK. I asked because 2003 sometimes has difficulty in "auto" debug mode. The
only mixed mode project I have is built with it and not 2005 so I don't know
if that has a bearing.
2. Debugger type is set to Auto - I will change this to mixed.

As long as you have a mixed-mode project I don't think it can hurt.
3. "Did you turn off the edit-and-continue option but continue to generate
the PDB file?" I don't know the answer to this question...I am new to
managed
code.

OK. Choose Properties from the Project Menu. Then in the left pane make sure
that the C++ options are expanded (click on the + sign if necessary). Select
the General item. In the right pane look for Debug Information Format.
Change to Program Database and rebuild your project.

Regards,
Will
www.ivrforbeginners.com
Mar 7 '07 #5
"Jim Walsh" <Ji******@discussions.microsoft.comwrote in message
news:45**********************************@microsof t.com...
At this point I have gotten thoroughly mixed up. Let me review:

I have two projects, one dependent on the other:

1. The first project is my Visual C++ program. I am compiling this project
as unmanaged, native, except for two modules. In the project properties, I
have set "No common Language Runtime support", Debug Information Format =
"Program Database for Edit & Continue (/ZI)", and Debugger Type = mixed.
I thought you started this thread by saying you needed to disable edit and
continue. To be honest, I can't tell you whether it is strictly necessary in
your case because I _always_ turn the option off. I always turn off
incremental linking as well.
There are two files in this project that I am compiling with /clr. For
these, I have set Debug Information Format = disabled. One of these files
uses a dialog class defined in the 2nd project.
I can't see how you'll be able to debug at the source code level if you turn
off debug information. Is the problem that you are unable to debug the
module for which you disabled debug information?

Regards,
Will
www.ivrforbeginners.com
Mar 7 '07 #6
Will,

I actually have the debugging part of this working.

Working with mixed assemblies really is tricky. But, I have finally figured
out a consistent set of switches that enable me to get debugging information.
The project settings that I have come up with are:

Debugger Type - Mixed
Debug Information Format: Program Database (/Zi)
Runtime Library: Multi-threaded Debug DLL (/MDd)
Precompiled Headers: Not using Precompiled Headers
Enable Minimal Rebuild: No
Enable C++ Exceptions: Yes with SEH Exceptions (/EHa)

This now compiles, and I can set breakpoints in both the unmanaged and
managed code, and trace from the unmanaged into the managed code.

New problem (actually an old problem) I have posted separately. The program
seems to run fine, but when I exit, I get an error in DomainUnload, when it
calls the function UninitializeAppDomain(). I have no idea what is going on
there.

Thanks again for your advice.
Jim

"William DePalo [MVP VC++]" wrote:
"Jim Walsh" <Ji******@discussions.microsoft.comwrote in message
news:45**********************************@microsof t.com...
At this point I have gotten thoroughly mixed up. Let me review:

I have two projects, one dependent on the other:

1. The first project is my Visual C++ program. I am compiling this project
as unmanaged, native, except for two modules. In the project properties, I
have set "No common Language Runtime support", Debug Information Format =
"Program Database for Edit & Continue (/ZI)", and Debugger Type = mixed.

I thought you started this thread by saying you needed to disable edit and
continue. To be honest, I can't tell you whether it is strictly necessary in
your case because I _always_ turn the option off. I always turn off
incremental linking as well.
There are two files in this project that I am compiling with /clr. For
these, I have set Debug Information Format = disabled. One of these files
uses a dialog class defined in the 2nd project.

I can't see how you'll be able to debug at the source code level if you turn
off debug information. Is the problem that you are unable to debug the
module for which you disabled debug information?

Regards,
Will
www.ivrforbeginners.com
Mar 7 '07 #7
"Jim Walsh" <Ji******@discussions.microsoft.comwrote in message
news:98**********************************@microsof t.com...
This now compiles, and I can set breakpoints in both the unmanaged and
managed code, and trace from the unmanaged into the managed code.
Congratulations.
New problem (actually an old problem) I have posted separately. The
program
seems to run fine, but when I exit, I get an error in DomainUnload, when
it
calls the function UninitializeAppDomain(). I have no idea what is going
on
there.
I can't say that anything rings a bell. Sorry.

Regards,
Will

Mar 7 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
4477
by: Ted Miller | last post by:
Hi folks, I'm looking at moving a large base of C++ code to .Net under tight time constraints. The code runs in mission-critical environments, and I am extremely concerned about the loader lock...
9
2565
by: Edward Diener | last post by:
I received no answers about this the first time I posted, so I will try again. My inability to decipher an MSDN topic may find others who have the same inability and someone who can decipher and...
8
3480
by: Bern McCarty | last post by:
Is it at all possible to leverage mixed-mode assemblies from AppDomains other than the default AppDomain? Is there any means at all of doing this? Mixed-mode is incredibly convenient, but if I...
8
1968
by: Nadav | last post by:
Hi, I am writing a performence critical application, this require me to stick to unmanaged C++ as performance is much better using unmanaged C++ ( about 33% better ), Still, I am trying to avoid...
10
1321
by: Serg | last post by:
Every time i am trying to step into virtual funtion debugger tells me "there is no source code available" and disassemble window appears. If function is non virtual debugger succefully steps into...
7
1406
by: Kevin Frey | last post by:
Using .NET 1.1. We have a mixed-mode assembly written in Managed C++ that we are using from an ASP.NET application that has been coded using C#. The mixed-mode assembly has its own...
8
2292
by: Edward Diener | last post by:
By reuse, I mean a function in an assembly which is called in another assembly. By a mixed-mode function I mean a function whose signature has one or more CLR types and one or more non-CLR...
0
1392
by: Russ Barrett | last post by:
Hello, I'm new to ASP.Net and I'm trying to interface an ASP.Net (C#) application to functionality resident in a C++ static lib. From posts I've seen around I understand this requires creation of a...
4
1526
by: =?Utf-8?B?QldC?= | last post by:
We have a mixed application that includes managed and unmanaged code. Until recently we've been able to remote debug by disabling the security policy to get the MFC managed dlls to load properly...
0
6953
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7105
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7144
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
4529
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3046
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3041
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1359
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
592
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
235
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.