Re: Problem with multithreaded C# app on Windows CE
- From: GT <GT@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 29 Aug 2006 11:58:02 -0700
Ok, let me get this straight:
Are you saying the Delegate's BeginInvoke() is not supported by the .Net
Compact Framework 2.0?
From the MSDN documentation I had the impression that both the Control's andthe Delegate's BeginInvoke() are supported by the .Net CF 2.0. Which is the
case?
The Visual Studio 2005 debugger does not complain about either.
"Paul G. Tobey [eMVP]" wrote:
The problem is that it's using BeginInvoke(). Not supported in .NET CF,.
although it's in the class definition. It's throwing a
NotSupportedException, as expected.
Paul T.
"<ctacke/>" <ctacke[@]opennetcf[dot]com> wrote in message
news:e5tfiu3yGHA.5048@xxxxxxxxxxxxxxxxxxxxxxx
The exception is in the thread. You have no handler, so when it bubbles
up, it comes out at the top - Application.Run. Trust me, Run is
supported.
Sorry, but I'm not going to go to MSDN, download the sample and massage it
into a device project just for the sake of helping you, and I doubt anyone
else in the newsgroup will either. If you'd like to post the code, then
we're happy to look at it for problems.
--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--
"GT" <GT@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:11542385-2D84-4209-958C-C1FCF4C00BB9@xxxxxxxxxxxxxxxx
You will have to download the code from MSDN (see link in my original
post).
The example is small and nice so it shouldn't take too long to compile
and
get it running.
If you do so you will see that the described problem is caused by
the folowing call in AsynchCalcPiForm.cs >calcButton_Click :
calcPi.BeginInvoke((int)digitsUpDown.Value, null, null);
This call does however not throw any exceptions, because adding a try{}
catch{Exception e} statement never causes the catch{} loop to be
executed.
Instead the VS2005 debugger indicates the NotSupportedException caused by
Application.Run() in main() as before.
Please take a look at the source code. It would make this a lot easier.
"<ctacke/>" wrote:
The exception is thrown elsewhere, probably in the worker thread itself.
We
need to see more code. You could also try adding some try/catch blocks
in
the thread proc to find it.
-Chris
"GT" <GT@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:8EBA8255-D94D-4768-A6AF-B550C46133A0@xxxxxxxxxxxxxxxx
Hello
I'm having a problem running a C# multithreaded application on Windows
CE
5.0.
The code I'm trying to execute is the source code of the MSDN article:
"Safe, Simple Multithreading in Windows Forms, Part 3" , January 2003,
written by Chris Sells
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnforms/html/winforms06112002.asp).
The source files consist of 'AsynchCalcPi.cs' and
'NineDigitsOfPiAt.cs'
found in
winforms01232003_sample\ch13\LongRunningOperations\.
(For VS2005 users: Start a new Windows CE project with Compact
Framework
2.0
installed and do some copy and past to get it running).
The code demonstrates a thread safe 'message passing model', in which
a
long
running operation (the calculation of n digits of pi) is performed on
a
worker thread.
Everything in the source code is supported by the .Net Compact
Framework
2.0
so this code should run just as well on both Windows CE and Windows
XP. At
least so I thought.
The problem is that the application executes just fine on Windows XP
(thanks
to MSIL), but I'm not able to get it running on Windows CE 5.0.
Strange,
isn't it?
What happens is that when i deploy the application from Visual Studio
2005
on the Windows CE target device, the application starts up by showing
a
form
in which you can type the number of decimals of pi you want to compute
and
a
button to start and cancel the computations.
When pressing the start button a worker thread is started from the
thread
pool by calling BeginInvok and set to do the computations.
This is also where the application fails on Windows CE: When pressing
the
start button a "NotSupportedException" is thrown and the Visual Studio
2005
debugger indicates that this is caused by
Application.Run(new AsynchCalcPiForm());
in the main method.
This I don't understand. The Windows Form is simpy launched from the
default
'Program.cs' file containing only the main method with the above
mentioned
statement.
What could be the problem here?
Why is this working on Windows XP but not Windows CE?
PS This question was posted under Mobile and Embedded
Development\Windows CE>Application Development but I was adviced to
post
it here instead.
- Follow-Ups:
- Re: Problem with multithreaded C# app on Windows CE
- From: Paul G. Tobey [eMVP]
- Re: Problem with multithreaded C# app on Windows CE
- References:
- Re: Problem with multithreaded C# app on Windows CE
- From: <ctacke/>
- Re: Problem with multithreaded C# app on Windows CE
- From: GT
- Re: Problem with multithreaded C# app on Windows CE
- From: <ctacke/>
- Re: Problem with multithreaded C# app on Windows CE
- From: Paul G. Tobey [eMVP]
- Re: Problem with multithreaded C# app on Windows CE
- Prev by Date: Re: Is RAPI the only way for sync data in my situation?
- Next by Date: UI Design Elements
- Previous by thread: Re: Problem with multithreaded C# app on Windows CE
- Next by thread: Re: Problem with multithreaded C# app on Windows CE
- Index(es):