Kinnara / ModernWpf

Modern styles and controls for your WPF applications
MIT License
4.51k stars 450 forks source link

ModernWpf.SampleApp throws `XamlParseException` when viewing the "Threaded UI" example. #660

Open dostjh opened 11 months ago

dostjh commented 11 months ago

ModernWpf.SampleApp throws XamlParseException when viewing the "Threaded UI" example.

I'm cloned to commit 218e8ec100caf4f653835d207977e631b869f7a4. I'm on Windows 11.

System.Windows.Markup.XamlParseException: ''Initialization of 'ModernWpf.Controls.ProgressBar' threw an exception.' Line number '29' and line position '15'.'

Inner Exception:
InvalidOperationException: The calling thread cannot access this object because a different thread owns it.

image

Callstack

>   PresentationFramework.dll!System.Windows.Markup.XamlReader.RewrapException(System.Exception e, System.Xaml.IXamlLineInfo lineInfo, System.Uri baseUri) Line 362 C#
    PresentationFramework.dll!System.Windows.Markup.WpfXamlLoader.Load(System.Xaml.XamlReader xamlReader, System.Xaml.IXamlObjectWriterFactory writerFactory, bool skipJournaledProperties, object rootObject, System.Xaml.XamlObjectWriterSettings settings, System.Uri baseUri) Line 121  C#
    PresentationFramework.dll!System.Windows.Markup.WpfXamlLoader.LoadBaml(System.Xaml.XamlReader xamlReader, bool skipJournaledProperties, object rootObject, System.Xaml.Permissions.XamlAccessLevel accessLevel, System.Uri baseUri) Line 38 C#
    PresentationFramework.dll!System.Windows.Markup.XamlReader.LoadBaml(System.IO.Stream stream, System.Windows.Markup.ParserContext parserContext, object parent, bool closeStream) Line 764   C#
    ModernWpf.SampleApp.exe!ModernWpf.SampleApp.ThreadedUI.ThreadedProgressBar.InitializeComponent() Line 1 C#
    ModernWpf.SampleApp.exe!ModernWpf.SampleApp.ThreadedUI.ThreadedProgressBar.ThreadedProgressBar() Line 10    C#
    [Native to Managed Transition]  
    [Managed to Native Transition]  
    mscorlib.dll!System.RuntimeType.CreateInstanceSlow(bool publicOnly, bool skipCheckThis, bool fillCache, ref System.Threading.StackCrawlMark stackMark)  Unknown
    mscorlib.dll!System.Activator.CreateInstance(System.Type type, bool nonPublic)  Unknown
    mscorlib.dll!System.Activator.CreateInstance(System.Type type)  Unknown
    ModernWpf.SampleApp.exe!ModernWpf.SampleApp.ThreadedUI.ThreadedVisualHost.CreateChild() Line 48 C#
    ModernWpf.SampleApp.exe!ModernWpf.SampleApp.ThreadedUI.ThreadedVisualHostBase.LoadChild.__ThreadProc|0() Line 187   C#
    mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)   Unknown
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)   Unknown
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
    mscorlib.dll!System.Threading.ThreadHelper.ThreadStart()    Unknown