FIX: You receive a "System.NullReferenceException: object reference not set to an instance of an object" error message when you implement JIT optimization by using a float

Article translations Article translations
Article ID: 813340 - View products that this article applies to.
Expand all | Collapse all

SYMPTOMS

When you compile some code, it may have valid Microsoft intermediate language (MSIL). However, when you run the compiled application, you receive the following Unhandled Exception error message:
System.NullReferenceException: Object reference not set to an instance of an object.
If optimization is turned off, this exception error does not occur.

RESOLUTION

A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

Note You must have a Visual Studio license agreement to obtain this hotfix.

To resolve this problem, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:
http://support.microsoft.com/contactus/?ws=support
Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

MORE INFORMATION

To reproduce this problem, use the C compiler, CL, to compile the following sample code, and then run the compiled application.

void float_fun(double a)
{
    *((float *)&a) = (float)a;
    while(1)
    {
        if(*((float *)&a))  break;
    }
}

int main()
{
     float_fun(1.00);
     return 0;
}
For more information about the terminology that is used to describe Microsoft product updates, click the following article number to view the article in the Microsoft Knowledge Base:
824684 Description of the standard terminology that is used to describe Microsoft software updates

Properties

Article ID: 813340 - Last Review: October 21, 2005 - Revision: 2.4
APPLIES TO
  • Microsoft Visual Studio .NET 2002 Professional Edition
  • Microsoft Visual Studio .NET 2002 Enterprise Architect
  • Microsoft Visual Studio .NET (2002), Enterprise Architect Edition SP1
  • Microsoft Visual Studio .NET 2002 Enterprise Developer
  • Microsoft Visual Studio .NET 2002 Academic Edition
Keywords: 
kbhotfixserver kbqfe kbvs2002sp1sweep kbcodesnippet kberrmsg kbfix kbbug KB813340

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com