6 Replies - 18194 Views - Last Post: 05 May 2012 - 04:31 PM

#1 Zooms  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 78
  • Joined: 04-December 08

Why is Control.CheckForIllegalCrossThreadCalls = False bad?

Posted 26 April 2012 - 01:24 PM

Okay, so just a quick question. I've been hearing a lot that the option specified in the title,
Control.CheckForIllegalCrossThreadCalls = False
,
is bad practice to use while programming, but I've never really heard any more than just that.

So, if anyone would mind explaining what makes it so bad, or pointing me to a post that states why, it'd be very helpful!

Thank you!

This post has been edited by Zooms: 26 April 2012 - 01:25 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Why is Control.CheckForIllegalCrossThreadCalls = False bad?

#2 m_wylie85  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 96
  • View blog
  • Posts: 899
  • Joined: 15-October 10

Re: Why is Control.CheckForIllegalCrossThreadCalls = False bad?

Posted 26 April 2012 - 01:27 PM

yes it is bad practice. You see if you do this you are not fixing the problem but hiding the problem which mean your program could crash so please avoid doing this.

This post has been edited by m_wylie85: 26 April 2012 - 01:34 PM

Was This Post Helpful? 0
  • +
  • -

#3 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1055
  • View blog
  • Posts: 4,085
  • Joined: 02-July 08

Re: Why is Control.CheckForIllegalCrossThreadCalls = False bad?

Posted 26 April 2012 - 02:12 PM

There are ways to delegate the work back to the thread.

Control.CheckForIllegalCrossThreadCalls is for debugging assistance not for a finished application.
Was This Post Helpful? 0
  • +
  • -

#4 Zooms  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 78
  • Joined: 04-December 08

Re: Why is Control.CheckForIllegalCrossThreadCalls = False bad?

Posted 27 April 2012 - 09:56 AM

@m_wylie85 - How do you mean it hides it? What makes it more prone to crashing because of it?

@_HAWK_ - Why is it not for finished ones?

Sorry for the questions, I'm just trying to understand 'why', and not just that it is, heh :)
Was This Post Helpful? 0
  • +
  • -

#5 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1055
  • View blog
  • Posts: 4,085
  • Joined: 02-July 08

Re: Why is Control.CheckForIllegalCrossThreadCalls = False bad?

Posted 27 April 2012 - 10:07 AM

Because you should not tell the compiler to not check them - it should or it will crash your app if the appropriate steps are not taken when multi-threading. The approach is using delegates to bring data from worker threads to the main UI thread to access controls.
Was This Post Helpful? 0
  • +
  • -

#6 Zooms  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 78
  • Joined: 04-December 08

Re: Why is Control.CheckForIllegalCrossThreadCalls = False bad?

Posted 05 May 2012 - 08:11 AM

I can understand why to use delegates, so that two threads won't collide when updating an UI object, or a similar situation to that occurs.
But still, is there any downsides *except* that?
Was This Post Helpful? 0
  • +
  • -

#7 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1055
  • View blog
  • Posts: 4,085
  • Joined: 02-July 08

Re: Why is Control.CheckForIllegalCrossThreadCalls = False bad?

Posted 05 May 2012 - 04:31 PM

I would say that is enough reason not to use it. Use the best practice always. Use delegates out lambda subs inside invocations.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1