473,387 Members | 1,481 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How can I see what's in a collection during debugging?

<I also posted this on microsoft.public.vsnet.debugging 'cuz I didn't know
which was more appropriate or would get quickest response>
Hello,

Can someone tell me how I can view the contents of a collection when in
debug mode?

For example, I working with a dataset and when the app stops at a breakpoint
I'd like to see what is actually in the Tables collection of the dataset. I
add a watch on my dataset variable and expand the Tables object. It just
keeps showing me the following: Count, IsReadOnly, Is Synchronized, Item and
SyncRoot. Expand SyncRoot and you're at the beginning of a big old
recursion.

So if I want to see what's in row x of table y for example, I have to create
a variable in my code representing that row in that table and add a watch
for THAT variable. I have to believe that there is an easier, more dynamic,
way for me to inspect the content of this during debugging.

Any help would be greatly appreciated.

David.

Nov 22 '05 #1
4 1788
Remember, collections are not the items themselves, they contain the items.
The Item property is actually what contains the values. Now, the debugger
is not good at listing items in the Item property so what you may have to do
is use an indexer to get at the data (assuming you are using C#). For
example, you would have to do myTbl[0] to see the properties, from there you
can access the rows, and so on.
"pantichd" <pa******@firstenergycorp.com> wrote in message
news:ey**************@TK2MSFTNGP14.phx.gbl...
<I also posted this on microsoft.public.vsnet.debugging 'cuz I didn't know
which was more appropriate or would get quickest response>
Hello,

Can someone tell me how I can view the contents of a collection when in
debug mode?

For example, I working with a dataset and when the app stops at a breakpoint I'd like to see what is actually in the Tables collection of the dataset. I add a watch on my dataset variable and expand the Tables object. It just
keeps showing me the following: Count, IsReadOnly, Is Synchronized, Item and SyncRoot. Expand SyncRoot and you're at the beginning of a big old
recursion.

So if I want to see what's in row x of table y for example, I have to create a variable in my code representing that row in that table and add a watch
for THAT variable. I have to believe that there is an easier, more dynamic, way for me to inspect the content of this during debugging.

Any help would be greatly appreciated.

David.

Nov 22 '05 #2
Peter,

First of all, thanks for responding.

I'm fairly new to .net (been doing Java for awhile) but I think I have a
pretty good handle on what collections are. : )

The situation I'm describing is something I've been able to do in other
tools.

It sounds like you're telling me that I really DO need to create a local
variable in my code to represent a specific table in the Tables collection
of a dataset.

I tried that and when I do a watch on that in the debugger I see that there
is an item called rows and another called rowCollection. When I expand those
I get in the recursion again.

The more I look at this the more I think I'm gonna have to define a local
variable to represent a specific row in a specific table. That seems very
inefficient. Please tell me there is a better way!

Thanks!

PS- I'm using VisualBasic.net

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:e1**************@TK2MSFTNGP15.phx.gbl...
Remember, collections are not the items themselves, they contain the items. The Item property is actually what contains the values. Now, the debugger
is not good at listing items in the Item property so what you may have to do is use an indexer to get at the data (assuming you are using C#). For
example, you would have to do myTbl[0] to see the properties, from there you can access the rows, and so on.

Nov 22 '05 #3
Kal
If you drill down into the dataset you will find tables. Drill down into it
and you will find columns and rows. Each of these has an items that you can
look at.
Kal

"pantichd" wrote:
Peter,

First of all, thanks for responding.

I'm fairly new to .net (been doing Java for awhile) but I think I have a
pretty good handle on what collections are. : )

The situation I'm describing is something I've been able to do in other
tools.

It sounds like you're telling me that I really DO need to create a local
variable in my code to represent a specific table in the Tables collection
of a dataset.

I tried that and when I do a watch on that in the debugger I see that there
is an item called rows and another called rowCollection. When I expand those
I get in the recursion again.

The more I look at this the more I think I'm gonna have to define a local
variable to represent a specific row in a specific table. That seems very
inefficient. Please tell me there is a better way!

Thanks!

PS- I'm using VisualBasic.net

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:e1**************@TK2MSFTNGP15.phx.gbl...
Remember, collections are not the items themselves, they contain the

items.
The Item property is actually what contains the values. Now, the debugger
is not good at listing items in the Item property so what you may have to

do
is use an indexer to get at the data (assuming you are using C#). For
example, you would have to do myTbl[0] to see the properties, from there

you
can access the rows, and so on.


Nov 22 '05 #4
>
Hello,

Can someone tell me how I can view the contents of a collection when in
debug mode?


Hi David.

I usually use Command Window for that purpose. It is accessible when
the application is stopped (let's say after it hit the breakpoint).
You can type something like:

?myDataset.Tables(1).Rows(5).ItemArray

or

?myDataset.Tables(1).Rows(5)("ColumnName")

You can also use the Watch Window. Declare the watch variable as:

myDataset.Tables(1).Rows(5).ItemArray

I prefer Command Window since you'll have the help of IntelliSense
there.

Hope this helps.
- Pedja.
Nov 22 '05 #5

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

Similar topics

9
by: Sasha | last post by:
Hi, I am extending standard IEnumerator, and I was just wondering what is the best way to make enumarator safe? What do I mean by safe? Detect deletes and all... My idea is to have private Guid...
4
by: pantichd | last post by:
<I also posted this on microsoft.public.vsnet.debugging 'cuz I didn't know which was more appropriate or would get quickest response> Hello, Can someone tell me how I can view the contents...
46
by: Keith K | last post by:
Having developed with VB since 1992, I am now VERY interested in C#. I've written several applications with C# and I do enjoy the language. What C# Needs: There are a few things that I do...
11
by: Daniel Billingsley | last post by:
Let's say I'm writing a business app and I want there to be only one instance of the Customer object for each particular customer (representing a database record) being edited. Would it be...
3
by: Madhur | last post by:
Hello This question is related to debugging. Suppose I add a Collection to my watch Window. Although that collection shows the count of item in it, there is no way I can see the some common...
0
by: Mike | last post by:
Hi, I have a collection object bound to a data grid, after I remove an item from the collection, the minute I click on the datagrid I get an error saying the specified argument was out of the...
2
by: JM | last post by:
Hi, I used to chage my code during debugging with Visual Studio 2003 (I just stopped the code using a break point and VS2003 allowed me to change the code, and continue debugging), but now with...
8
by: Brian | last post by:
What's the best way to debug code that is being run during garbage collection? We are getting AccessViolationExceptions that seem to be happening during garbage collection. But when it hits the...
14
by: johndonnelly | last post by:
HI, I am trying to figure out how to write a C# program to add parameter's "A" and "B" and return "C" in the following code: I get an error at the commnd.ExecuteNonQuery(); statement below. The...
2
by: smileprince00 | last post by:
what is meant by break point in the sql server studio.. what is the purpose of it..let me know clearly........................ and one more thing is i am hearing a word regularly while...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.