|
I think you're going to need to be a little clearer in the explanation of what's happening before any one will be able to help you.
alesh_nitre wrote: ..I have thrown an exception from a my business logic code
Is this a custom exception or one of the standard .NET exceptions? How are you throwing it?
alesh_nitre wrote: the execution control gets lost after I raise a business exception
This doesn't make sense to me. What do you mean "the execution control gets lost"?
|
|
|
|
|
Thanks for such an urgent reply and sorry for a lousy explanation! But two days back i myself was unable to locate or reason about the cause of the problem. I'll explain better now. (Please ignore previous post)
About "the execution control gets lost" ->
I was debugging the code using VS2005 debugger pressing F10 and F11 along my way. But the moment the exception was thrown following things used to occur
1. The yellow arrow that shows current executing statement used to get lost
2. The call stack window used to go blank suddenly.
3. The application hung.
The app used to hang even in the release mode and so on.
-------------------------------------------------------------------
Neways. Now that i have better idea why this is happening I have summerised the code as follows. Please have a look at this -
private void button1_Click(object sender, EventArgs e)
{
// this code snippets reproduces the problem i stated
MySqlConnection con = new MySqlConnection("server=192.168.1.45;user id=root;Password=pqrs;database=dev");
//(I am using MySql .NET Connector 5.1.2)
con.Open();
try
{
// Select from any table that ***HAS BLOB DATA FIELD***
string selCmd = "SELECT * FROM document";
using (MySqlCommand allDocsCmd = new MySqlCommand(selCmd, con))
{
//Execute Reader
using (MySqlDataReader reader = allDocsCmd.ExecuteReader())
{
// ... some logic may be while(reader.read()) loop etc.
// Say this code throws an excpeption at some point..
throw new ApplicationException("Any exception ..");
// we expect the the execution control to go in the catch block below but
// it gets lost in the manner i told
}
}
}
catch (Exception ee)
{
MessageBox.Show(ee.Message);
}
}
|
|
|
|
|
The code looks ok to me. Given the explanation, it sounds like you are actually hitting an exception in the MySqlDataReader code. When you get into that state, try pressing the "pause" button on the debug toolbar, which will break the execution and place you on the currently executing line of code. If it can't find the code, it should tell you and give you the option of looking at the assembly code. You could also try narrowing the try/catch by putting it inside the innermost using block directly around the code you think is throwing the exception.
Also, are you using .NET 2.0 or later? If not, you can try adding a blank catch block. It's possible (although unlikely) that the code is throwing an exception that isn't properly wrapped as a .NET exception. The empty catch block will catch that, but you won't have any exception data.
|
|
|
|
|
You are rite! the problem is indeed with MySqlDataReader..
btw I tried what you suggestd.. but pressing pause returned the control to the "throw new App.." statement with the arrow in green color.
To dig further suspected the 'using' blocks in my code made it hang. so I removed them to find that my doubt was right. I closed the reader manually rather than the 'using' doing it for me.. following is the code..
<br />
string selCmd = "SELECT * FROM document";<br />
MySqlCommand allDocsCmd = new MySqlCommand(selCmd, con);<br />
MySqlDataReader reader = allDocsCmd.ExecuteReader();<br />
reader.Close();
The execution hangs at reader.Close();
This for sure is now a MySqlDAtaReader related problem..I selected everything else but the blob field from the table and it worked fine i.e.
"select id,data from document" hangs but
"select id from document" works ok.
('data' is a LONGBLOB field in document table)
I am searching a cause and fix but lemme know if you have ne idea why this is happening..
Thanx.
|
|
|
|
|
Good to hear that you have tracked down the problem. I'm not familiar with the MySqlDataReader code so I probably won't be able to help you there. The pause button trick works most of the time, but as you found it doesn't work all of the time. It was worth having you try it, just in case.
If you have access to the source code for the MySqlDataReader, you should probably start there and look at what the Close method is actually doing. If not, you can try using Reflector[^] to look at the code.
My guess, since this works correctly as long as you exclude the blob field, is that the blob field is allocating another datatype internally which isn't being properly handled in the Close call.
|
|
|
|
|
I will work on the reader.Close() and put a small update here so that others get help if they bump in to this kinda problem..neway. the "press pause button" trick is helping when everything seems 'frozen'. The green arrow appears and pressing F10 shows this messsage
The CLR has been unable to transition from COM context 0x191288 to COM context 0x1913d8 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.
|
|
|
|
|
alesh_nitre wrote: I will work on the reader.Close() and put a small update here so that others get help if they bump in to this kinda problem
That would be good.
The message you are getting is really nothing more than Visual Studio telling you that the application has frozen and isn't responding to messages. It's a 50/50 chance that the message is actually meaningful and the application is really frozen.
|
|
|
|
|
Hi
Iam using C#.Net 2.0 backend is MS Access....
When I want to update a record folowing exception has been appeared:
Concurrency violation: the UpdateCommand affected 0 of the expected 1 records
Can anyone help me about the cause of the exception?
regards
Somasundaram
|
|
|
|
|
To test concurrency the database access test whether any changes have happened since you loaded the data.
Have a look at the original data (assuming you are using DataSets) and the data in the database.
They differ and therefore the db access can not find the record it should update.
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
hello,
Does anyone have the crack of the installshield 2008.
best regards.
dghdfghdfghdfghdgh
|
|
|
|
|
Most of us are developers, not thieves. But, if you give me your home address, I'll mail it to you ( seriously, I won't turn you in to the police for trying to take away the livelihood of programmers like me, I promise )
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I'm with you on this one, it seems like the world and their dog (or Amsterdam Council and ellllllllie at least) want to take away the jobs we love :/
|
|
|
|
|
No. Purchase a legitimate copy instead of stealing one.
|
|
|
|
|
You were looking for a crack?? It's behind you, just below your belt.
The same can be found on the front of your head, between your hair and neck.
|
|
|
|
|
I assume this is the same one he's talking out of. One word for him. A**hole.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Dave Kreskowiak wrote: You were looking for a crack?? It's behind you, just below your belt.
That is a good one
"Find it your bloody self - immediately!" - Dave Kreskowiak
|
|
|
|
|
There's a really great idea - advertise that you are after dodgy software, and then expect people here to be:
a - interested in illegal software
and
b - stupid enough to reply to this with anything other than a no.
Seriously, are you:
a) moronic
b) moronic
or
c) moronic
Please tick all that apply. Multiple answers will be accepted.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
no
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I wonder how long it will take before every active CPian has replied to this
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Chris hopes that will not happen; it would probably kill the server farm.
Anyway, if they do, they really should simply say "no"
especially since Pete said "stupid enough to reply to this with anything other than a no";
why didn't he take his own advice?
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Luc Pattyn wrote: why didn't he take his own advice?
There was too much room for mockery and scorn - the little imp in me just couldn't resist. He had to come out and tap away at that keyboard; the little scamp.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
ellllllllie wrote: Does anyone have the crack of the installshield 2008.
I work hard writing software so I can put food on my table and keep a roof over my head... And you want to take that from me.
YOU THIEF!
How about I come round to your house and take the food directly out of your kitchen? Would you like that!? How about I throw you out of your house so I can sleep there instead!
You are nothing but a putrid stain on society. You are a product of disgust and revulsion. Your request is repugnant in the extreme and your expectation that you would get an answer is sickening.
You come here to a site for professional software developers and ask them how to purloin the efforts of their labour. Would you ask a mother to kill her own child just for your benefit?
You are the scum who would rob a homeless man of his blanket just to line your own bed. You would take the last bite of food from a starving child to fatten your belly. Well, I hope you choke on your own vomit, you distasteful wretched miserable excuse for a human.
Your request is as shameful as you are dispicable.
|
|
|
|
|
Uhh... Colin?? You OK man??
|
|
|
|
|
|
One thing is for sure, I don't think anyone will feel they are able to add to what's already been said, now.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|