.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 ‘Visual’

PRB: Exception Code 0xE06D7363 When Calling Win32 SEH APIs

Symptoms
When you call Win32 Structured Exception Handling (SEH) APIs, such asGetExceptionCode() and GetExceptionInformation(), sometimes the systemreports the following exception code:

0xE06D7363 Sometimes GetLastError() also returnsthis value. This exception code will be used for any error that is raised by the Microsoft Visual C++ compiler through a call to “throw”.
Resolution
All Visual C++ exceptions thrown from code generated by the MicrosoftVisual C++ compiler contain this error code. Because this is a compiler-generated error, the code is not listed in the Win32 API header files. The code is actually a cryptic mnemonic device, with the initial “E” standing for “exception” and the final 3 bytes (0×6D7363) representing the ASCII values of “msc”.

FIX: A System.NullReferenceException exception occurs when you deploy a composite database project in Microsoft Visual Studio Team System 2008 Database Edition GDR

Symptoms
Consider the following scenario in Microsoft Visual Studio Team System 2008 Database Edition GDR: You have a database project that includes tables.You have another database project that includes constraints for the tables in the same solution and you add a reference to the database project that includes tables.You connect both projects to the same target database on a server.Then, you deploy the projects to the database.In this scenario, you receive a System.NullReferenceException exception and then the Visual Studio IDE crashes. If you debug this exception, you receive the following error message:

System.NullReferenceException: Object reference not set to an instance of an object.
Resolution
To resolve this problem, upgrade to Microsoft Visual Studio Team System 2008 Database Edition GDR R2. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
970479?(http://support.microsoft.com/kb/970479/) List of fixed issues in the Microsoft Visual Studio Team System 2008 Database Edition GDR R2
Note Microsoft Visual Studio Team System 2008 Database Edition GDR R2 replaces Microsoft Visual Studio Team System 2008 Database Edition GDR.

FIX: A System.ArgumentException exception occurs when you try to create a Windows form that inherits from a Windows form that contains a dataset

Symptoms
When you try to create a Windows form that inherits from a Windows form that contains a dataset in Microsoft Visual Studio .NET 2003, you may receive the following exception error message:

An unhandled exception of type ‘System.ArgumentException’ occurred in system.data.dll
Additional information: Cannot add primary key constraint since primary key is already set for the table.
Resolution
If the dataset contains nested datatables, Visual Studio .NET incorrectly tries to add additional code to the inherited Windows form to enforce constraints on the inherited dataset. This code tries to add a constraint that already exists on the dataset. Therefore, the behavior that is mentioned in the “Symptoms” section occurs.

Error message when you use CommandBuilder: “An unhandled exception of type ‘System.NullReferenceException’ occurred”

Symptoms
If you use the CommandBuilder object to explicitly get commands for the DataAdapter object as follows:

da.InsertCommand = cb.GetInsertCommand and then run the following Visual Basic .NET code

cb.DataAdapter = Nothing or the following Visual C# .NET code

cb.DataAdapter = null; the commands that you add to the DataAdapter are deleted, and you receive the following error message:

An unhandled exception of type ‘System.NullReferenceException’ occurred in app_name.exe
Additional information: Object reference not set to an instance of an object.
Resolution
CommandBuilder deletes the commands that it generates when it is disassociated from a DataAdapter. CommandBuilder and DataAdapter are linked; when they are unlinked or disassociated, the commands are nulled. This problem does not affect commands that you build from the beginning (from scratch).

BUG: You receive a COMException exception when you pass late-bound parameters to methods of Office objects in Visual Basic 2005 or in Visual Basic .NET

Symptoms
In a Microsoft Visual Basic 2005 or Microsoft Visual Basic .NET application, when you pass late-bound parameters to methods of Microsoft Office objects, you may receive COMException exceptions. For example, when you pass the Name property of a late-bound UserProperty object to the UserProperties.Items method, you may receive the following error message:

An unhandled exception of type ‘System.Runtime.InteropServices.COMException’ occurred in microsoft.visualbasic.dll
Additional information: Property is read-only.Note Similar symptoms may also occur when you call methods of other Microsoft Office objects.
Resolution
If you pass a property of an object to a method by reference and the property has a set accessor, Visual Basic calls the set accessor to set the property to the value that the method returns. At compile time, if you pass a property of a late-bound object, the Visual Basic compiler cannot determine whether the property is passed by reference. Also, the Visual Basic compiler cannot determine whether the property has a set accessor. Therefore, the Visual Basic compiler permits the late binder to determine these details at run time.
However, if the relevant objects are Component Object Model (COM) objects at run time, the late binder cannot obtain sufficient information about these details. The late binder uses managed reflection to try to determine these details. The late binder assumes that such method calls involve a ByRef parameter and that the property that you pass has a set accessor. If the property that you pass does not have a set accessor, the Microsoft .NET Framework generates a MissingMethodException exception. The late binder handles the MissingMethodException exception.
The .NET Framework generates a MissingMethodException exception when the call to a method of a Microsoft Office object returns a HRESULT value of COR_E_MISSINGMETHOD. The Microsoft Office object is a COM object. Visual Basic .NET incorrectly assumes that all the methods of Microsoft Office objects return COR_E_MISSINGMETHOD if the property that you pass does not have a set accessor. However, not all the methods of Microsoft Office objects return COR_E_MISSINGMETHOD if the property that you pass does not have a set accessor. Therefore, the behavior that is mentioned in the “Symptoms” section of this article occurs if you pass a property that does not have a set accessor, such as the UserProperty.Name property, to a method.
Note This behavior does not occur if you use early-bound Microsoft Office objects.

BUG: You receive a “System.Runtime.InteropServices.COMException” message when you bind an ImageList ActiveX control to a CoolBar ActiveX control

Symptoms
In Microsoft Visual Studio 2005 or in Microsoft Visual Studio .NET, when you set the ImageList property of the CoolBar ActiveX control to the ImageList ActiveX control, and then you run the application, you receive the following exception:

An unhandled exception of type ‘System.Runtime.InteropServices.COMException’ occurred in axinterop.comctl3.dll
Additional information: Invalid property value. Note You cannot set the ImageList property of the CoolBar ActiveX control in the Properties window.
Resolution
Microsoft Visual Basic 2005, Microsoft Visual Basic .NET, and Microsoft Visual C# .NET interpret the ImageList property of the CoolBar ActiveX control as a read-only property. Therefore, Visual Basic 2005, Visual Basic .NET, and Visual C# .NET throw an exception when you set the ImageList property of the CoolBar ActiveX control to the ImageList ActiveX control.