Installed WPF app not starting after upgrading Microsoft.Extensions.Hosting to 10.0.0
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
### Description
I've upgraded my WPF app with the latest released package versions (10.0.0). The app runs fine from Visual Studio. However, when generating an installer (with a vdproj file) and installing the app, the application doesn't start. I found the exception in the windows event viewer.
```
CoreCLR Version: 9.0.1125.51716
.NET Version: 9.0.11
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Windows.Markup.XamlParseException: The method or operation is not implemented.
---> System.NotImplementedException: The method or operation is not implemented.
at System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlType(BamlType bamlType, Int16 typeId)
at System.Windows.Baml2006.Baml2006SchemaContext.GetXamlType(Int16 typeId)
at System.Windows.Baml2006.Baml2006Reader.Process_ElementStart()
at System.Windows.Baml2006.Baml2006Reader.Process_OneBamlRecord()
at System.Windows.Baml2006.Baml2006Reader.Process_BamlRecords()
at System.Windows.Baml2006.Baml2006Reader.Read()
at System.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReader xamlReader, XamlObjectWriter xamlWriter, Boolean onlyLoadOneNode, Boolean skipJournaledProperties, Boolean shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack`1 stack, IStyleConnector styleConnector)
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
--- End of inner exception stack trace ---
at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at MyCompany.MyAppName.App.InitializeComponent() in C:\Code\clone1\MyCompany.MyAppName\App.xaml:line 1
at MyCompany.MyAppName.App..ctor(CLIOptions cliOptions) in C:\Code\clone1\MyCompany.MyAppName\App.xaml.cs:line 23
at MyCompany.MyAppName.Program.<>c.b__0_0(CLIOptions cliOptions) in C:\Code\clone1\MyCompany.MyAppName\Program.cs:line 27
at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
at MyCompany.MyAppName.Program.Main(String[] args) in C:\Code\clone1\MyCompany.MyAppName\Program.cs:line 16
```
I've pinpointed the package that causes this to be Microsoft.Extensions.Hosting. Version 9.0.11 works fine, but 10.0.0 breaks the app.
If I generate a single file with things like `true`, `false`, `win-x64`, and `true` it seems to work again, but we rather not do that.
### Reproduction Steps
If really required, I could probably make some app, but it would take me some time to make this.
### Expected behavior
The installed application runs as it would from Visual Studio.
### Actual behavior
The installed application crashes on startup
### Regression?
It worked/ is working with Microsoft.Extensions.Hosting version 9.0.11
### Known Workarounds
Generate a single file with things like `true`, `false`, `win-x64`, and `true`
### Configuration
.net 9, going to 10.
Windows 11 Pro 10.0.22631 build 22631
x64
### Other information
some native libraries are missing? Exception is unclear. Also weird that it's a XAML error, while it's the Hosting package that causes the issue.
The installation executable (msi) is a fair amount larger (15%) with 10.0.0 than with 9.0.11, so more=less?
Contributor guide
Assessment
This issue has not been assessed yet.