Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

Commented Unassigned: MessageBox Exception in Xceed but not in WinForms. [21046]

$
0
0
Hello all,

__first I have to say thank you for this toolkit ! It is awesome !!__

I have found an issue when I wanted to replace the MessageBox of WinForms with the Xceed Message Box.

I am starting with MessageBox.Show(...) a message box from an STA background thread. If I use the WinForms MessageBox everything works OK.
But if I just replace the reference to System.Windows.Forms with the reference to Xceed, I get following Exception when calling MessageBox.Show(...):


```
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.
at System.Windows.Threading.Dispatcher.VerifyAccess()
at System.Windows.Threading.DispatcherObject.VerifyAccess()
at System.Windows.Application.get_Windows()
at Xceed.Wpf.Toolkit.MessageBox.ComputeOwnerWindow()
at Xceed.Wpf.Toolkit.MessageBox.CreateContainer()
at Xceed.Wpf.Toolkit.MessageBox.ShowDialog()
at Xceed.Wpf.Toolkit.MessageBox.ShowCore(Window owner, String messageText, String caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult, Style messageBoxStyle)
at Xceed.Wpf.Toolkit.MessageBox.Show(String messageText, String caption, MessageBoxButton button, Style messageBoxStyle)
at Xceed.Wpf.Toolkit.MessageBox.Show(String messageText)
```

In general I know what the exception is about (Dispatcher, etc...) but I wanted to ask if this behavior is expected by your developers or are you planning to change the behavior in future.

It would be nice if it will be fixed in the future that people just easily exchange their old implementation and not having to concern about the dispatcher.

Thank you all in advance !!
Comments: ** Comment from web user: BoucherS **

Hi,

Can you provide a small sample with the exception ?
Thanks.

You don't need to use a WindowContainer to use the MessageBox, but it is a better way of doing things. It will control modal windows.


Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>