Conversion from: Microsoft ActiveX Data Objects is referenced to cause. NET Runtime 2.0 Error Reporting System Error.
Http://www.bmpj.net/forum-viewthread-tid-563-fromuid-2.html
After the. NET Program was upgraded in the last day, the system Error message. NET Runtime 2.0 Error Reporting is displayed. After the program runs for a period of time, the program automatically exits. An exception report is displayed in the event viewer, and this error cannot be captured by the program. I have been depressed for several days.
In this case, I initially suspected that it was a registry access permission problem. It turns out that this is not the case. I create an ACCESS database dynamically every day, and the software running error occurs almost one day later. Therefore, I suspect that the problem of dynamic ACCESS is also true. Let me analyze it as follows:
System error message:
Event Type: Error
Event Source:. NET Runtime 2.0 Error Reporting
Event Type: None
Event ID: 1000
Date: 2011-5-22
Event: 17:37:35
User: N/
COMPUTER: SCALE-9E9260CE1
Description:
Faulting application scl_run.exe, version 1.0.0.272, stamp 4dd08573, faulting module unknown, version 0.0.0.0, stamp 00000000, debug? 0, fault address 0x4dd7640a. For more information, see Help and Support Center in http://go.microsoft.com/fwlink/events.asp.
Note: If the faulting module unknown is displayed, the problem cannot be identified.
1. I saw an article on the Internet that correctly closed the connection to the ACCESS database created by ADOX. CatalogClass. The Code is as follows, which is my description:
Add two COM component references:
1) Microsoft ActiveX Data Objects 2.8 Library // referencing this component will result in the above error message, not a code problem, but a conflict with the System
2) Microsoft ADO Ext. 2.8 for DDL and Security
Create a database:
ADOX. CatalogClass catalog =
New ADOX. CatalogClass ();
String str =
"Provider = Microsoft. Jet. OleDB.4.0 ";
Str + =
"; Data Source ="
+ File;
Str + =
"; Jet OLEDB: Engine Type = 5 ";
Str + =
"; Locale Identifier = 0x0804 ";
Catalog. Create (str );
Close the database:
// -------------------------- It is mainly the reference of this Code, which leads to the error message. There is no problem in writing the code format and habits --------------------------//
ADODB. Connection connection = catalog. ActiveConnection as ADODB. Connection;
If (connection! = Null)
{
Connection. Close ();
}
// Outputs //--------------------------------------------------------------------------------------------------------------------//
Catalog. ActiveConnection = null; // In addition, the Connection above has been closed. If you write it like this, the error "COM object cannot be used after it is separated from its basic RCW" will be thrown.
Catalog = null;
2. solution:
(1) remove the reference to Microsoft ActiveX Data Objects 2.8 Library.
(2) After the ACCESS database is created successfully, you should change it:
A general operation method
Finally solved, I did not expect that a few lines of code will cause so many problems.
Catalog. ActiveConnection = null;
Table = null;
Catalog = null;
GC. Collect ();
GC. WaitForPendingFinalizers ();
B Advanced Operations
Marshal. FinalReleaseComObject (table );
Marshal. FinalReleaseComObject (catalog. ActiveConnection );
Marshal. FinalReleaseComObject (catalog );
GC. Collect ();
GC. WaitForPendingFinalizers ();