You may receive the following error message:
An unhandled exception of type 'System.OverflowException' occurred in client.exeThis problem may occur when the following conditions are true:
Additional information: Overflow
Additional information: Overflow
- You call a method that is defined in a Microsoft Component Object Model (COM) DLL from a Microsoft Visual C# .NET program or a Microsoft Visual Basic .NET program.
- In the application code, the method is located after the System.Math.Asin function. The System.Math.Asin function returns Not a Number (NaN).
This problem occurs because the new common language runtime and the Microsoft Visual Basic 6.0 DLL or Microsoft Visual C++ DLL handle the floating point variables inconsistently.
To resolve this problem, obtain the latest service pack for Microsoft . NET Framework 1.0. To download the latest service pack, visit the following Microsoft Developer Network (MSDN) Web site:
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section. This problem was first corrected in Microsoft .NET Framework 1.0 Service Pack 3.
Steps to reproduce the behavior
Create a COM DLL in Visual Basic 6.0
- Start Visual Basic 6.0.
- On the New Project dialog box, on the
New tab, click ActiveX DLL, and then click
Open. By default, a class module file that is named Class1 appears.
- Add the following code to the Class1 class module file:
Public Function Avg() As Double
Avg = 0/1
- On the File menu, click Make Project1.dll. The Make Project dialog box appears.
- Locate a folder to save the Project1.dllfile, and then click OK to save the file.
Create a client application
- Start Visual Studio .NET.
- On the File menu, point to
New, and then click Project. The New Project dialog box appears.
- Click Visual C# Projects under
Project Types, and then click Console Application under Templates.
- In the Name box, type
Client, and then click OK. By default, a file that is named Class1.cs is created.
- Replace the existing code with the following code:
static void Main(string args)
Class1Class T = new Class1Class();
double D = Math.Asin(2);
- On the Project menu, click Add Reference. The Add Reference dialog box appears.
- Click Browse. The Select Component dialog box appears.
- Locate the Project1.dll file that you created in the "Create a COM DLL" section, click Project1.dll, and then click
- In the Add Reference dialog box, click
OK to add the DLL to your Client project.
Build and then run the project
- On the Build menu, click Build Solution.
- Press CTRL+F5 to run the application without a debugger. The Just-In-Time Debugging dialog box appears.
- Click Yes. The Attach to Process dialog box appears.
- Click OK.
You may notice the behavior that is mentioned in the "Symptoms" section.
824684 Description of the standard terminology that is used to describe Microsoft software updates
For additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base:
817248 How to call a Visual Basic .NET assembly from Visual Basic 6.0 and call a Visual Basic COM component from Visual Basic .NET
315847 How to use ActiveX components in Visual Studio .NET with Visual Basic .NET
ID článku: 329658 - Poslední kontrola: 28. 4. 2008 - Revize: 1