473,729 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Very strange error when running debug code

TB
I am seeing a very strange problem as follows...

I have a loop where a fair amount of processing is going on and near
the top of the loop I access a class that has only static helper
functions to perform some calculations. After some number of
iterations, randomly, I'll get an uncaught NullValueExcept ion error on
one of these calls, as if the class name is being treated as an object
reference and is null. Here is some psuedo-code to illustrate:

Object anObject = GetNextObject() ;
while (anObject != null)
{
double a_value = StaticClass.Cal culateA(anObjec t); // !!!
double b_value = StaticClass.Cal culateB(anObjec t);

// Lots of processing

anObject = GetNextObject() ;
}

When I get the exception it is invariably on the first static function
call.

What is truly strange is that this problem will come and go depending
on minor, apparently unrelated changes made near the bottom of the
iteration. For example, simply inserting the statement:

int foo = 150;

where 'foo' is never actually referenced or used anywhere seems to
"fix" the problem. Wrapping the static function calls in a try-block
also seems to "fix" the problem (no exceptions are ever caught -- the
mere presence of the try-catch construct seems to cure the problem).

If I compile for release and run the code outside of the VS.NET
environment there is never any problem.

So..., I'm suspecting some problem either in the debugging code or
running debugging code in the VS.NET environment but really have no
good means to track this down any further. It's not critical since I
seem to have a work-around (I picked the try-catch as opposed to
setting 'foo' to 150 :-) I was just curious whether anyone had
encountered anything similar? Thanks!

-- TB
Nov 15 '05 #1
2 1783
"TB" <tb*********@ka xy.com> wrote in message
news:cd******** *************** ***@posting.goo gle.com...
I am seeing a very strange problem as follows...

I have a loop where a fair amount of processing is going on and near
the top of the loop I access a class that has only static helper
functions to perform some calculations. After some number of
iterations, randomly, I'll get an uncaught NullValueExcept ion error on
one of these calls, as if the class name is being treated as an object
reference and is null.
<snip>


It's not clear, but what you're describing sounds like the error is being
thrown *inside* the CalculateA method. Without seeing what CalculateA does,
it could be anything, e.g. CalculateA may be trying to dereference a null
data member of the non-null object.
Nov 15 '05 #2
TB
"Bret Mulvey [MS]" <br***@online.m icrosoft.com> wrote in message news:<vFHlb.134 0$275.5580@attb i_s53>...
"TB" <tb*********@ka xy.com> wrote in message
news:cd******** *************** ***@posting.goo gle.com...
I am seeing a very strange problem as follows...

I have a loop where a fair amount of processing is going on and near
the top of the loop I access a class that has only static helper
functions to perform some calculations. After some number of
iterations, randomly, I'll get an uncaught NullValueExcept ion error on
one of these calls, as if the class name is being treated as an object
reference and is null.
<snip>


It's not clear, but what you're describing sounds like the error is being
thrown *inside* the CalculateA method. Without seeing what CalculateA does,
it could be anything, e.g. CalculateA may be trying to dereference a null
data member of the non-null object.


Apologies for not being able to supply more information, but the
actual code is too complex to supply here (not to mention most likely
considered proprietary by my employer). While it's possible the
exception is being generated somewhere inside the static function keep
in mind the following...

1) I know the object being passed into the static functions is not
null and that nothing inside the object is null -- the nature of the
iteration and the "GetNextObj ect" call guarantee that.

2) The static functions themselves are using this object in a
straightforward fashion and not doing anything that would try to
reference some other, null object.

3) The problem never manifests when run in release mode.

4) The problem appears to go away by the simple insertion of
completely innocuous code elsewhere in the iteration loop.

These static functions *do* serve as wrappers around procedures
imported from old, C DLLs. Perhaps something in the InteropServices
is vulnerable to this kind of weird, intermittent behavior??

A co-worker has pointed out that he observed this type of problem a
lot with the 1.0 version of C#.NET but it appeared to go away for him
when he upgraded to VS.NET 2003 (which I am also using).

-- TB
Nov 15 '05 #3

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

Similar topics

5
3017
by: Sam | last post by:
Guys facing a strange problem any clue would really rescue me.. i am using a ASP application with following things Server : Intel Xeon (TM) CPU 2GHz, 2GB RAM, 136GB HDD OS : Windows 2000 Advanced server. IIS5.0 Database: Oracle (Using ADODB to connect to the Database) App server running on the same machine (COM+)
5
16254
by: Tony Wright | last post by:
Hi, I am having a problem installing an msi for a web site. The error message I am getting is: "The specified path 'http://mipdev05/features/Fas2' is unavailable. The Internet Information Server might not be running or the path exists and is redirected to another machine. Please check the status of this virtual directory in the Internet Services Manager."
9
1496
by: Abby Lee | last post by:
http://www.ncsa.uiuc.edu/Divisions/Admin/reimb.asp There is just too much code to place here. onChange you trigger a function to add the numbers in the the column you entered an amount in (scripts have been made for only the first 2 columns). The information is passed to a second function that adds all the numbers in the row you are in and puts a total at the end. This part works great unless you place an "8", "88", "888", etc. in the...
0
565
by: Martijn Remmen | last post by:
I have developed a service which exposes a COM object. This service is running perfect on Windows 2000 Server and Windows 2000 Professional under the SYSTEM account. When the service is installed on Windows 2003 Server, the application works well, and the COM object can be called just as it's meant to be. The service is however running under the IWAM account (I know strange account to run a service). However, after a while (from...
7
5016
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying. I created the websetup and built the MSI, have the bundled version. Copied to webserver and ran Websetup.msi. Said I had to remove old version, which I did, then reran WebSetup.msi and keeps giving me this error. "The installer was interrupted...
2
1938
by: Kris Vanherck | last post by:
yesterday i started getting this strange error when i try to run my asp.net project: Compiler Error Message: CS0006: Metadata file 'c:\winnt\microsoft.net\framework\v1.1.4322\temporary asp.net files\spsweb\0e3514bf\cb1844e7\assembly\dl2\3b163f 16\00452d31_84e5c301\infragistics.webui.ultrawebgrid.v3.dll' could not be found
2
2647
by: Piedro | last post by:
Can someone reproduce the following error? I'm using the module at the bottom of my post to owner draw a menu items, I call the module from a form like this: Private Sub mnuOpen_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles mnuOpen.DrawItem Dim Ic As New Icon(Application.StartupPath & "\101_72.ico") DrawItems(e, mnuOpen, Ic) End Sub
11
1849
by: VijaKhara | last post by:
Hi all, I just write a very simple codes in C and vthere is a very strange bug which I cannot figure out why. The first loop is for v, and the second for k. There is no relationship between v and k but if I debug and watch the change of the variable after each command. When the sencond loop happends for k, the values of vs change and are set to be equal some values of k. Specifically, v is
1
2289
by: pitjpz | last post by:
We have moved our Database to another server. The server it was on used SQL 4 and the new one its on now uses SQL5 the only problem we can find is that when you attempt to delete a record from the DB the following happens: When Deleting a record: Fatal Error: Can't call method "fetchrow_arrayref" on an undefined value at GT::SQL::File::delete_records line 275. Stack Trace: GT::Base (2704): main::fatal called at...
0
8932
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8767
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
9428
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9163
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...
0
8168
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
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
6028
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();...
2
2702
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2173
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.