Creating multi-thread UI has a very very low probability to crash
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
* .NET Core Version: 3.0.100-preview-009812 But not sure because we can't reproduce it
* Windows version: Windows 10.0.17763.0
* Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
**Problem description:**
An exception is thrown when multi-threaded UI is shown during the application startup and the application crashes. We created a solution to reproduce it but actually, we got the issue at #297 but still can't reproduce this one.
**Actual behavior:**
```
System.Windows.Markup.XamlParseException: Collection was modified; enumeration operation may not execute. ---> System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
在 System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
在 System.Collections.Generic.List`1.Enumerator.MoveNextRare()
在 System.Collections.Generic.List`1.Enumerator.MoveNext()
在 System.Windows.Baml2006.WpfSharedBamlSchemaContext.GetKnownXamlType(Type type)
在 System.Windows.Baml2006.WpfSharedBamlSchemaContext.GetXamlType(Type type)
在 System.Windows.Baml2006.Baml2006SchemaContext.GetXamlType(Type type)
在 System.Xaml.XamlObjectWriter.GetXamlType(Type clrType)
在 System.Xaml.XamlObjectWriter.WriteEndMember()
在 System.Xaml.XamlWriter.WriteNode(XamlReader reader)
在 System.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReader xamlReader, XamlObjectWriter xamlWriter, Boolean onlyLoadOneNode, Boolean skipJournaledProperties, Boolean shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack`1 stack, IStyleConnector styleConnector)
在 System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
--- End of inner exception stack trace ---
在 System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
在 System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
在 System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
在 System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
```
**Expected behavior:**
Don't crash.
**Minimal repro:**
Maybe it is the same reproduction to #297 but we only receive these exceptions from our partners' PCs and we can't reproduce it in our PCs.
Contributor guide
Assessment
This issue has not been assessed yet.