Skip to main content

Microsoft Silverlight

Answered Question MessageBox crashesRSS Feed

(0)

GearWorld
GearWorld

Participant

Participant

840 points

1,101 Posts

MessageBox crashes

See this screenshot that shows you a crash on a MessageBox call, and this is RANDOMLY.  I don't always get the error but after a few run, and I tried to pin point a way to reproduce it and I was unable to.

http://pages.videotron.com/gear/weird.jpg

 

lingbing
lingbing

Contributor

Contributor

2249 points

406 Posts

Answered Question

Re: MessageBox crashes

Yes, it is a silverlight bug. This is duo to across-threading issue. Actually MessageBox.Show() method has dealed that issue, however, for some unknown reason it sometimes crashes.

When you call MessageBox.Show, if you can make sure that it is not the UI-thread, you can call Deployment.Current.Dispatcher.BeginInvoke to invoke the method call, but if you don't know that, don't use that.

And use System.Windows.Browser.HtmlPage.Window.Dispatcher.BeginInvoke is more safe, you can use that to invoke a method call. That method should be System.Windows.Browser.HtmlPage.Window.Alert/Confirm. The looking is as same as MessageBox.Show, you can have a try.

Regards!

Ling Bing
Bei Jing University of Aeronautics and Astronautics
Bei Jing, China

GearWorld
GearWorld

Participant

Participant

840 points

1,101 Posts

Re: MessageBox crashes

Hey Thank  ya !

 

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities