SQL Compact debugging problem
-
Wednesday, August 19, 2009 9:00 PMI have inserted a SQL Compact DB 3.5 into my project which added a dataset which I then added the tables to. This created the tables and table adapters.
Ok I am able to insert but I would like to get any errors back from the update so I can act on them. Like if the record is duplicated it would be nice to know instead of it did not work.
The problem i am having is where I can see the error if I walk into the designer code when I return I am getting an error saying the stack has been cleaned by the GC. Below is the basic code, is there another way of doing this?
LocalCoinCollectionsDataSetTableAdapters.
CoinboxCollectionsTableAdapter adapter = null;
try {
adapter = new EcoinboxConsole.LocalCoinCollectionsDataSetTableAdapters.CoinboxCollectionsTableAdapter();
int cnt = adapter.Insert(p1, p2, p3);
return cnt == 1;
} catch(SqlCeException sqlEx)
{
Console.WriteLine(sqlEx.Message);
}
I am getting the following error:
{Cannot evaluate expression because a thread is stopped at a point where garbage collection is impossible, possibly because the code is optimized.}
Regards,
John
jjhii- Moved by Roahn Luo Friday, August 21, 2009 7:44 AM not a C# general issue. (From:Visual C# General)
All Replies
-
Friday, August 21, 2009 7:43 AMHello,
Just to confirm with you, have we set the Configuration Manage to Debug Mode when building the project?
(We could open the Configuration Manager by right clicking the solution name and choose Properties)
Best regards,
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have any feedback, please tell us.
Welcome to the All-In-One Code Framework! -
Friday, August 21, 2009 12:42 PM
Roahn,
Yes I am in debug mode. In an attempt to be more clear: VS created the dataset "LocalCoinCollectionsDataSet.xsd" which contains the designer.cs files. In that file there is the insert(...) function. I am able to see the reason for the error at that point using the debugger so yea I know what the problem is when debugging. What I am trying to do is figure out what the problem is in code. Normally I do things like if sqlEx.Number = 2627 do something the problem is that the exception is coming back blank (discarded).
try { int returnValue = this.Adapter.UpdateCommand.ExecuteNonQuery(); return returnValue; } finally { // **** I can see the error message here ****** if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { this.Adapter.UpdateCommand.Connection.Close(); } } Regards,
John J. Hughes II
http://www.functioninternational.com/ -
Saturday, August 04, 2012 10:40 PMOwner
Roahn,
Yes I am in debug mode. In an attempt to be more clear: VS created the dataset "LocalCoinCollectionsDataSet.xsd" which contains the designer.cs files. In that file there is the insert(...) function. I am able to see the reason for the error at that point using the debugger so yea I know what the problem is when debugging. What I am trying to do is figure out what the problem is in code. Normally I do things like if sqlEx.Number = 2627 do something the problem is that the exception is coming back blank (discarded).
try { int returnValue = this.Adapter.UpdateCommand.ExecuteNonQuery(); return returnValue; } finally { // **** I can see the error message here ****** if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { this.Adapter.UpdateCommand.Connection.Close(); } } Regards,
John J. Hughes II
http://www.functioninternational.com/Try a VS forum on MSDN.
Thanks!
Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)
- Marked As Answer by Ed Price - MSFTMicrosoft Employee, Owner Saturday, August 04, 2012 10:40 PM

