.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 c’

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).

A C++ exception that is thrown in a DLL module causes an Illegal Instruction exception

Symptoms
A C++ exception result is not caught in the enclosing C++ exception handler.
This behavior occurs when certain code in one module calls a function in a different module. Specifically, when the code in the try block calls a function in an EXE module or in a DLL module that is different from the module that contains the try block and the C++ exception handler.
This behavior may cause unexpected behavior or may cause the application to stop responding.
When you use the Embedded Visual C++ debugger, the debugger may report the following exception:

0xC000001D Illegal Instruction
Resolution
This problem occurs because the ARM compiler does not generate the correct code for the C++ exception handler when a function in a different EXE module or DLL module is called.