Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / April 2007

Tip: Looking for answers? Try searching our database.

Variables out of scope in Class Library

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JBeerhalter@gmail.com - 08 Apr 2007 01:21 GMT
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
David Lowndes - 08 Apr 2007 10:31 GMT
>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
[quoted text clipped - 4 lines]
>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
Ben Voigt - 09 Apr 2007 15:15 GMT
> >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
[quoted text clipped - 8 lines]
> 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
David Lowndes - 09 Apr 2007 17:17 GMT
>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
JBeerhalter@gmail.com - 09 Apr 2007 19:23 GMT
> >Have you set the debugger type to "Mixed"?
>
[quoted text clipped - 6 lines]
>
> 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;

}
JBeerhalter@gmail.com - 09 Apr 2007 19:27 GMT
On Apr 9, 1:23 pm, JBeerhal...@gmail.com wrote:

> > >Have you set the debugger type to "Mixed"?
>
[quoted text clipped - 17 lines]
>
> - 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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.