|
Hi Mav,
AFAIK Control.BeginInvoke() causes execution on the same thread Invoke() does: the thread on
which the Control's handle got created; that should not be a ThreadPool thread...
On the other hand, if somehow the ThreadPool is involved, then maybe this statement
holds the clue: "There is one thread pool per process. The thread pool has a default size of 25 threads per available processor".
Maybe the failing PC has fewer processors than the others?
Regards,
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
|
|
|
|
|
There are actually two types of BeginInvoke[^], one for controls and one for delegates.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Hi Tom, thanks for clarifying this. It explains how the ThreadPool may get involved...
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
|
|
|
|
|
This may have something to do with Code Access Security[^], but I'm not positive. When using BeginInvoke, the calling thread's stack must be serialized (so the security permissions can be checked when the invoked method is actually run). If it's a single call you are having problems with, then this may not be it.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Hi Tom!
Thanks for your suggestion, this is one aspect I haven't checked yet.
But since all the applications are running on the same PC I didn't expect a problem with CAS. Besides - if some security permissions are not set correctly, wouldn't you expect a SecurityException instead of an 8 second delay?
But nevertheless, I'll check it tomorrow, thanks.
I'm really clutching at straws here
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
If it's running correctly then you probably have the correct permissions. I was thinking the checking of the permissions might be your issue. There are some gotchas with CAS that I do know about though (e.g. running a .Net application from a network share results in low trust).
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Also, you can try coding up another application that simply calls your application using ShellExecute. If your version runs fine, then maybe they are doing more than just calling ShellExecute.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
ReHi!
I've tried this and couldn't reproduce the problem this way. It's really wicked.
The only additional hint I got was when a VNC viewer we were using to access the particular client also started giving error messages (GDI related), so perhaps there's a general problem (HW?) with this machine.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
If it always happens when your app is started from the third-party app and never happens when your app is started directly, then I would not think it's a general problem. If it were then you would see the issue when the third-party app is not launching your app.
If this is only happening on that single box (regardless of how it was launched), then I would agree that it was a problem with the machine.
Even when launched from the third-party app, does it always take 8 seconds to execute? Are there other instances of BeginInvoke that are used?
Have you tried using perfmon (Performance Monitor) to see if your application is starving the ThreadPool? Also, can try logging the number of available threads[^]?
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Hooray, at least I got a clue.
Today I got a chance to look at the machine in question and found out the reason for the delay. It was not machine-related, was not thread-pool related and could be reproduced on another machine.
The reason was/is the way the third-party app is calling our program.
They are calling ShellExecute() and then immediately enter a busy wait for 10 seconds waiting for a response file from us.
Once the timeout occurred, operation of the other app went back to normal (i.e. not cluttering the processor with busy waits) and our app finally got started.
Strangely enough, as soon as I lowered the third party app's priority, the call did come through and operation was almost normal.
I'll have to investigate further because I could then reproduce the effect with a little test application, but not if I called notepad instead of our app. Notepad opened reasonably fast. A hello world WinForms-app also took veeeery long to start up under these conditions.
But at least now I got something to work on...
Thanks for your suggestions!
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi
I m facing exception while saving an image. The code is
//this line throws Exception
picturebox.Image.Save(memorystream, System.Drawing.Imaging.ImageFormat.Jpeg );
and exception is:
"A generic error occurred in GDI+."
So plz tell me the solution
Regards
Shanzay
|
|
|
|
|
My guess is that there is something up with the memory stream.
Try saving the image to a file (by passing a string) instead of a stream. If the error still occurs, then it must be a problem with the image.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
Hi,
almost all errors occuring in GDI+ lead to the same message, so it can be many things.
Most liekly in your case: you have forgotten to reposition the stream, if you write data
to a stream, its position advances; now if you want to save the image, you need to
set the position to zero again. Try memorystream.Position=0 before Image.Save
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
|
|
|
|
|
hi,
Thanx for reply.
I did this but still getting this error.Actually I m sending Live video from server to client and after recieving every frame this error is displaying so what should I do in this Scenario.
Shanzay
|
|
|
|
|
did you succeed in saving to a file as the other reply suggested?
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
|
|
|
|
|
yah well I got success by adding two things
1. used thread.Sleep() before saving
2. used file.jpg instead memorystream.
Thanx.
Shanzay
|
|
|
|
|
I am developing a windows application and reqiure to make POPUP Window when my application is minimized to show message what ever i want.
|
|
|
|
|
Dear dikshant,
You have to have an windows form ready as a POP UP window ...
Once you have the form ready ...
you have create an object of that form class and need to call show method of the form class object ..
here is the pseudo code for that .....
frmPopup _fPopup=new frmPopup()
_fPopup.show();
hope it helps !! :->
Thanks,
Arindam D Tewary
|
|
|
|
|
What kind of pop up window do you want ??
|
|
|
|
|
You really were patient enough to wait 9 minutes before asking the same question again?
Great.
But I think you were missing the word "URGENT" in your requests.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
A MessageBox?
If I have understood your question, all you need is MessageBox on the right event.
Something like this:
MessageBox.Show("Your message.", "Caption");
Is this helping?
|
|
|
|
|
Hello I am developing Windows application required to make a POPUP Window when application Minimized so how can i make that popup window.
|
|
|
|
|
|
dikshant@p-dd.com wrote:
Hello I am developing Windows application required to make a POPUP Window when application Minimized so how can i make that popup window.
Don't ask the same question twice within 9 minutes of each other. Be patient and someone will respond.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
hi frns
i have one dropdown list,button and a grid view in my proj i have filled dropdown list with my database tables values as select items now i want to display in the details of item1 column values in grid view when i select item1 in dropdown list and click on button
plz send me asnwers as early as possible
regards
sunil
|
|
|
|