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

Home Posts Topics Members FAQ

Variables out of scope in Class Library

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

Apr 8 '07 #1
5 1942
>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
Apr 8 '07 #2

"David Lowndes" <Da****@example.invalidwrote in message
news:1n********************************@4ax.com...
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. :(
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.
>
Dave

Apr 9 '07 #3
>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
Apr 9 '07 #4
On Apr 9, 12:12 pm, David Lowndes <Dav...@example.invalidwrote:
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
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;
}

Apr 9 '07 #5
On Apr 9, 1:23 pm, JBeerhal...@gmail.com wrote:
On Apr 9, 12:12 pm, David Lowndes <Dav...@example.invalidwrote:
>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

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

Apr 9 '07 #6

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

Similar topics

6
by: Hal Vaughan | last post by:
Being self taught, this is one thing I've always had trouble with -- I finally get it straight in one situation and I find I'm not sure about another. I have a class that keeps calling an...
30
by: Neil Zanella | last post by:
Hello, Suppose I have some method: Foo::foo() { static int x; int y; /* ... */ }
5
by: j | last post by:
Anyone here feel that "global variables" is misleading for variables whose scope is file scope? "global" seems to imply global visibility, while this isn't true for variables whose scope is file...
9
by: Stefan Turalski \(stic\) | last post by:
Hi, I done sth like this: for(int i=0; i<10; i++) {...} and after this local declaration of i variable I try to inicialize int i=0;
2
by: Mark Sisson | last post by:
Hi all. SITUATION ================ 1. I have a base class with a member variable that's an object 2. I have several classes that inherit from the base class. 3. There are several methods in...
23
by: Tim Anderson | last post by:
Is this expected behavior? Winform with button and listbox: Dim i As Integer For i = 0 To 50 Dim s As String If i = 1 Then s = "Only once?" End If
4
by: kuhrty | last post by:
I am using a window form and trying to get a dataset used in the form globally but I am having an issue setting the property and setting it locally to the class. When I try to call the dataset...
4
by: Stephen Walch | last post by:
Our application environment consists of three basic layers: 1. Third-party unmanaged DLLs that were written before the CLR was invented and maintain a significant amount of information (including...
111
by: Nate | last post by:
Hello, I am looking for a method to automatically declare variables in C. I'm not sure if there is a good way to do this, but I had something like this in mind... int i; for(i = 1; i < 4;...
0
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
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
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
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.