Re: (VS 2005 Beta)Illegal cross-thread operation
From: Richard Blewett [DevelopMentor] (richardb_at_NOSPAMdevelop.com)
Date: 11/18/04
- Next message: Chakravarthy Bollapalli \(IFIN SCC AI\): "Dynamic invocation and interfaces"
- Previous message: Dmitriy Lapshin [C# / .NET MVP]: "Re: Inactive application"
- In reply to: [Yosi]: "Re: (VS 2005 Beta)Illegal cross-thread operation"
- Next in thread: Jon Skeet [C# MVP]: "Re: (VS 2005 Beta)Illegal cross-thread operation"
- Messages sorted by: [ date ] [ thread ]
To: microsoft.public.dotnet.languages.csharp Date: Thu, 18 Nov 2004 05:22:12 -0800
Well its *always* been a restriction in the WIndows UI and its been documented hundreds of times in different ways both nby Microsoft and others that you must not (repeast must not) interact with UI components from any thread other than the one on which they were created.
Of course this hasn't stopped people either not realising or ignoring this information. With .NET 1.x they decided to help people get it right by creating the InvokeRequired and BeginInvoke methods on all UI components. BeginInvoke marshalled a method call on to the correct UI thread. However, this didn't stop people not realising what they were there for or ignoring their existence.
So now they have decided to be more blunt and cause the UI elements to refuse to work in debug mode if people use them incorrectly - they are still allowing it in release builds (but thats just a performance optimization). If your code is failing in debug builds with this error then you have a nasty insideous bug in your code which you should fix. Your users will not thank you for giving them an application that crashes in non-reproducible ways for no apparent reason.
I think its a good thing when the tools show up a bug in your code - for example, would you prefer it if the compiler didn't tell you when you put = instead of ==? When people migrate to 2005 they will not be forced immediately to rebuild the app and deploy it for .NET version 2. They will have to make changes because of other API differences anyway - or at least go through a regression test cycle. So this is the opportunity to fix these bugs.
Regards
Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk
Since Microsoft Allowd such a bad thing, there are product doing this bad
think , It's is so bad that Microsoft don't alowd this any more , if this
true, Microsoft must inform all those companies about this , so they can
decide if to buy the new VS2005 or not, (if to continue use the bad usage or
to make new release with the fix..)
I think they should add an option to allowd this or not (my in security
option list).
- Next message: Chakravarthy Bollapalli \(IFIN SCC AI\): "Dynamic invocation and interfaces"
- Previous message: Dmitriy Lapshin [C# / .NET MVP]: "Re: Inactive application"
- In reply to: [Yosi]: "Re: (VS 2005 Beta)Illegal cross-thread operation"
- Next in thread: Jon Skeet [C# MVP]: "Re: (VS 2005 Beta)Illegal cross-thread operation"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|