Re: (VS 2005 Beta)Illegal cross-thread operation

From: Richard Blewett [DevelopMentor] (richardb_at_NOSPAMdevelop.com)
Date: 11/18/04


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).
 



Relevant Pages

  • Re: (VS 2005 Beta)Illegal cross-thread operation
    ... Since Microsoft Allowd such a bad thing, there are product doing this bad ... > me to access public methode of one Class from other Thread. ... > The new thread need to call methodes from his father like myfathe.methode, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: [IMPORTANT] obfuscators
    ... Richard Blewett - DevelopMentor ... I realized that code security can easily be corrupted by cheap decompilers. ... What does Microsoft suggest using to disable or at the least make it ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Aborting Threads
    ... > DevelopMentor is a training company that specializes in distributed ... > have always been the Geurilla courses, ... > I've been teaching, freelance, for DevelopMentor for about 5 years, ... > we train alot of Microsoft people in .NET and other technologies). ...
    (microsoft.public.dotnet.framework)
  • Re: .Net 2.0 internal debate - looking for opinions
    ... Dominick Baier - DevelopMentor ... We have no problems but we have added our own tblRoles table to go with the aspnet_Roles table that Microsoft provides. ... extra information, because one table is cleaner than two. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: 2.0 availablity?
    ... Maybe Microsoft should name it 2006 at the beginning. ... > In theory before Dec 31st - if not they will have to rename the next ... > Richard Blewett - DevelopMentor ... Prev by Date: ...
    (microsoft.public.dotnet.framework)