.NET Questions and Solutions

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘microsoft visual studio 2005’

FIX: A floating-point exception may occur when an inline function in a C++ application returns an uninitialized floating-point variable in Visual Studio 2005

Symptoms
Consider the following scenario:In Microsoft Visual Studio 2005, you create a C++ application.You do not specify the /fp:except option. Therefore, floating-point exceptions are not enabled in the C++ application.You do not specify the /fp:strict option. Therefore, the strict floating-point model is not enabled in the C++ application.An inline function in the C++ application returns an uninitialized floating-point variable.You compile the C++ application.In this scenario, a floating-point exception may occur when you run the C++ application. Additionally, you may receive the following error message:

0xC0000090: Floating-point invalid operation.Note This problem may occur in debug builds and in release builds.
Resolution
This problem occurs when the uninitialized floating-point variable loads a memory location that contains a signaling not-a-number (NaN) value.

BUG: Error message when you try to pass a Collection object from Visual Basic 6.0 components to Visual Basic 2005 or to Visual Basic .NET: “System.InvalidCastException”

Symptoms
When you try to pass a Collection object fromMicrosoft Visual Basic 6.0 components to Microsoft Visual Basic 2005 or to Microsoft Visual Basic .NET, you may receive an error message. In Microsoft Visual Studio 2005, you receive the following error message:

An unhandled exception of type ‘System.InvalidCastException’ occurred in ApplicationName.exe
Additional information: Unable to cast object of type ‘Microsoft.VisualBasic.Collection’ to type ‘VBA.Collection’.In Microsoft Visual Studio .NET, you receive the following error message:

An unhandled exception of type ‘System.InvalidCastException’ occurred in ApplicationName.exe
Additional information: Specified cast is not valid.If you examine the type of the collection object that Visual Basic 2005 or Visual Basic .NET expects, you find that Visual Basic 2005 or Visual Basic .NET expects the VBA.Collection type instead of the Microsoft.VisualBasic.Collection type. If you change your code to pass a collection object of the VBA.Collection type, you receive the following error message on the line of code where you try to create a new instance of the VBA.Collection class:

An unhandled exception of type ‘System.Runtime.InteropServices.COMException’ occurred in ApplicationName.exe
Additional information: COM object with CLSID {A4C4671C-499F-101B-BB78-00AA00383CBB} is either not valid or not registered.This problem also occurs in other Microsoft .NET Framework-supported languages such as Microsoft Visual C# 2005 and earlier versions of .NET Framework-supported Microsoft Visual C#.
Resolution
The InvalidCastException error occurs because the Microsoft.VisualBasic.Collection type is incompatible with the VBA.Collection type. The COMException error occurs because only a Visual Basic 6.0 application can create an instance of the VBA.Collection class. You cannot create an instance of the VBA.Collection class outside a Visual Basic 6.0 application.

BUG: A BadImageFormatException exception may occur when you use a recursively defined constraint of a generic type in a .NET Framework 2.0-based application

Symptoms
In a Microsoft .NET Framework 2.0-based application, you use a recursively defined constraint ofa generic type. When you do this, a BadImageFormatException exception may occur at run time. This problem occurs only in certain scenarios.
Resolution
This problem occurs because of an issue in the Microsoft Visual Studio 2005 common language runtime (CLR 2.0) components.