Variables out of scope in Class Library

J

JBeerhalter

I have a very simple application that consists of two projects in VS
2005. The first is a simple forms application with a button on it, and
then second is a class library with one public ref object in it with a
couple methods. I can reference the class library just fine, and I
can call methods in it, but if I start debugging and step into any of
the methods in the class library, I cannot see the values of any
variable passed into any method, they always show up as "out of scope"
This is making debugging nearly impossible.

For instance if we have the following method in the class library

void DoSomethingCool(String ^string1, String ^string2)
{
......All the cool logic in here
}

Then string1 and string2 will always be "out of scope" in the watch
window.

In C# this works fine right out of the box, but with VS C++/CLI I
can't make it work.

-JB
 
D

David Lowndes

I have a very simple application that consists of two projects in VS
2005. The first is a simple forms application with a button on it, and
then second is a class library with one public ref object in it with a
couple methods. I can reference the class library just fine, and I
can call methods in it, but if I start debugging and step into any of
the methods in the class library, I cannot see the values of any
variable passed into any method, they always show up as "out of scope"
This is making debugging nearly impossible.

If it's any consolation you're not alone. When debugging a mixed C#
and C++/CLI solution I find that many things in the C++/CLI code don't
display in the debugger. :(

Dave
 
B

Ben Voigt

David Lowndes said:
If it's any consolation you're not alone. When debugging a mixed C#
and C++/CLI solution I find that many things in the C++/CLI code don't
display in the debugger. :(

Have you set the debugger type to "Mixed"? "Auto" automatically does the
wrong thing every time, in my experience. Expect a considerable slowdown in
starting the debug session, as symbols are now processed for every system
DLL used by the framework, but.... you should be able to debug C++ at that
point.
 
D

David Lowndes

Have you set the debugger type to "Mixed"?

Yep - without it I can't debug into the C++/CLI/native code.

I can debug into the C++/CLI native code, but many variables don't
display correctly in the debugger - enums for one thing. I've not
found time to bug it for VS2005 but it's on my mental list of things
to check out when Orcas enters beta.

Dave
 
J

JBeerhalter

Yep - without it I can't debug into the C++/CLI/native code.

I can debug into the C++/CLI native code, but many variables don't
display correctly in the debugger - enums for one thing. I've not
found time to bug it for VS2005 but it's on my mental list of things
to check out when Orcas enters beta.

Dave

I've found that if I simply write hideous code like the following I
can step in an debug just find

void CoolProcedure(String^ string1, String^ string2)
{
String ^debuggableString = string1;


}
 
J

JBeerhalter

I've found that if I simply write hideous code like the following I
can step in an debug just find

void CoolProcedure(String^ string1, String^ string2)
{
String ^debuggableString = string1;



}- Hide quoted text -

- Show quoted text -

Sorry about the double post, I accidentally gave the send button focus
and clicked enter.

Anyway

void CoolProcedure(String^ string1, String^ string2)
{
String ^debuggableString1 = string1;
String ^debuggableString2 = string2;

......Useful code goes here


}

Its definately tedious to put the extra code in, debug, and then pull
the code back out, but at least debuggableString1 and debuggaleString2
actually evaluate in the watch window, whereas string1 and string2 do
not.

-JB
 

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