473,657 Members | 2,415 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with Debugging

I'm hoping someone can help me out with using the Visual Studio IDE for
debugging.

I'm working on a Windows Forms application (it's an MDI if it matters), and
I'm trying to fix a bug in my program. What's happening is
when the program is running, it runs into an exception error and switches
back to the Visio Studio screen. The problem is that it's not
showing me the line of code which actually caused the exception. Instead it
is showing the code for my startup form there is a green arrow
beside the "Public Class frmMain" line at the top of the code. How do I
have VS automatically jump to the line which caused the exception?

I've figured out where the problem is happening, by putting some breaks in.
I have a break before the line which is causing the exception
(this line is in the code of a different form, frmParts.vb, not frmMain.vb)
When it hits the break, it switches back to VS and highlights the
line with the break in frmParts. I press Step Into, it runs the line of
code, and then comes back to VS and highlights the next line in frmParts
(this is the line that's causing the exception). When I press Step Into
again, it runs the code, and comes back to VS with the dailog "An
unhandled exception of type 'System.Argumen tOutOfRangeExce ption' occurred in
system.windows. forms.dll" That is fine, but now it's
highlighting the "Public Class frmMain" in frmMain.vb. I want it to be
highlighting the line which caused the exception, not the Public
Class line of the parent form.

In case it matters, the build type is set to "Debugging" , not "Release"

Is there a problem with the way I'm trying to do debugging here? Please
keep in mind that I'm not asking for help with what's causing the
exception errors, I'm asking for help in the debugging process.

Any suggestions are appreicated.
Nov 21 '05 #1
4 1520
Maybe I should also mention that the debugger used to act the way I wanted
it to (highlight the line that caused the exception upon breaking), but then
for some reason it started doing what I have described (green arrow) - so I
have a feeling it's an option somewhere maybe?

I looked through the MSDN library, and all I've been able to figure out is
that the green arrow has something to do with the call stack. I have no
clue what to do about it through.
Nov 21 '05 #2
Jason Hunt wrote:
The problem is that it's not
showing me the line of code which actually caused the exception.


Do you have the IDE set to break on exceptions?

Select Debug>Exception s from the menu, and select the "Common Language
Runtime Exceptions" item in the list. Then in the "When the exception is
thrown" box, select "Break into the debugger."

This will cause the code to break immediately any exception occurs, allowing
you to see exactly where it happened.

--

(O) e n o n e
Nov 21 '05 #3
The green arrow just means that the error is happening on a line of code in
the block being called by the line that the green arrow is pointing to.

You could put a breakpoint where the green arrow is, re-run the code, and
use F11 to get to the called block. If you use Try blocks in all your
routines, and use the StackTrace property of the exception, you should be on
your way to resolving errors more quickly.

"Jason Hunt" wrote:
Maybe I should also mention that the debugger used to act the way I wanted
it to (highlight the line that caused the exception upon breaking), but then
for some reason it started doing what I have described (green arrow) - so I
have a feeling it's an option somewhere maybe?

I looked through the MSDN library, and all I've been able to figure out is
that the green arrow has something to do with the call stack. I have no
clue what to do about it through.

Nov 21 '05 #4
Hi Guys,

Thanks for the assistance. It turns out that what I described (green arrow
pointing to startup form instead of actual line of code) was only happening
when the exception was caused outside of the startup form's class. I have a
"business objects" class which does all the underlying work, and then the
forms for all the UI stuff which open instances of the business class. The
form was calling a function in the business class, and it there was a
missing bracket in an SQL query.

Charlies' suggestion of using Try/Catch narrowed it down.

Nov 21 '05 #5

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

Similar topics

11
3997
by: James | last post by:
My form and results are on one page. If I use : if ($Company) { $query = "Select Company, Contact From tblworking Where ID = $Company Order By Company ASC"; }
5
2355
by: Jerry Polyak | last post by:
Can someone give me a pointer, please. I am getting the following errors: Notice: Undefined index: sender_name in c:\program files\apache group\apache\htdocs\allinone_form.php on line 12 Notice: Undefined index: sender_email in c:\program files\apache group\apache\htdocs\allinone_form.php on line 14
6
7582
by: Ken Varn | last post by:
I am trying to remote debug a C# application but the debugger is reporting the following exception: An unhandled exception of type 'System.IO.FileLoadException' occurred in Unknown Module. Additional information: Unverifiable assembly 'FrameGrabber' failed policy check. The FrameGrabber assembly is a C++ managed DLL.
10
2703
by: Brian Conway | last post by:
I have no idea what is going on. I have a Login screen where someone types in their login information and this populates a datagrid based off of the login. Works great in debug and test through VS, however, when I change to release and put it out on the web it fails giving me the following error message The underlying connection was closed. Could not establish a trust relationship with the remote server.
4
4778
by: Martin Odhelius | last post by:
Hello, I have a very fustrating problems while debugging ASP.NET applications. When I am debugging and stepping thru code (with F10 or F11) Visual Studio some times suddenly just stop responding and the only way get it up and running again is to kill the aspnet_wp.exe process. When the debugger hangs there is almost no CPU load, so it doesn't seem to be any hidden eternal loop or anything like that. I have tried to reinstall IIS and...
7
6953
by: yuanlinjiang | last post by:
I am working on converting a win32 console application from VC6 to VC7. My version is Microsoft Development Environment 2003 version 7.1.3088. The code works fine on VC6. it is a console program for scientific computation, so it has nothing to do with MFC. But it needs some other libraries such as MKL, sparselib, etc. VC7 can build the executable successfully. However, when i run it, there is only one line on the command window:
23
3194
by: keyser_Soze | last post by:
I have MS Visual Studio 2003 on Windows XP Pro. I have IIS running on this machine and I am trying to debug some existing code which has both ASP and ASP.NET components. When I try and launch the debugger from VS, I am told it can't because the project is of output type class library. The error indicates I should set the start action to start external program or start URL. I tried both of these and cannot seem to get the debugger to...
9
2729
by: SAL | last post by:
Hello, I have a Dataset that I have table adapters in I designed using the designer (DataLayer). I have a business logic layer that immulates the DataLayer which may/may not have additional logic in. My business classes are, of course, decorated with the: <System.ComponentModel.DataObject() attribute. So, I drop a GridView on a webform and set its datasource to an ObjectDatasource which in turn is using one of my business logic...
4
2667
by: =?Utf-8?B?bXVzb3NkZXY=?= | last post by:
Hi guys I'm working on a web app in VS2005 (.net 2.0.50727). All is working fine, except when I add a HTTPModule to my web.config file, as follows... <httpModules> <add name="UrlRewrite" type="UrlRewrite" /> </httpModules> If I do that, I get a really huge dialog box which basically says "Unable to
0
8324
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5642
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2742
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 we have to send another system
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.