WPF Application using Installer crashes when including MenuAdv on .NET 9

Our application crashes on startup on .NET 9 when installed (using Wix Toolset). I have attached a minimal example.

The sample works fine on .NET 7 and .NET 8. It also works when you remove the Syncfuison dependencies or running the application directly from Visual Studio. However, when using .NET 9, the MenuAdv control and installing the application, the problem occurs.

To test this, the application doesn't actually need to be installed. The application needs to be published using the supplied profile. The resulting build will crash on startup. (The installer project must be built to get the installer).

The Windows event log shows the following stack trace:

Application: WpfInstallerTest.exe CoreCLR Version: 9.0.124.61010 .NET Version: 
9.0.1 Description: The process was terminated due to an unhandled exception. 
Exception Info: System.Windows.Markup.XamlParseException: Die Angabe eines Werts 
für "System.Windows.Baml2006.TypeConverterMarkupExtension" führte zu einer 
Ausnahme. ---> System.IO.FileNotFoundException: File name: 
'WindowsFormsIntegration, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at 
System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, 
StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext, 
RuntimeAssembly requestingAssembly, Boolean throwOnFileNotFound) at 
System.Reflection.Assembly.Load(AssemblyName assemblyRef) at 
System.Windows.Baml2006.Baml2006SchemaContext.ResolveAssembly(BamlAssembly 
bamlAssembly) at System.Windows.Baml2006.Baml2006SchemaContext.GetAssembly(Int16 
assemblyId) at 
System.Windows.Baml2006.Baml2006SchemaContext.EnsureXmlnsAssembliesLoaded(String 
xamlNamespace) at 
System.Windows.Baml2006.Baml2006SchemaContext.GetXamlType(String xamlNamespace, 
String name, XamlType[] typeArguments) at 
MS.Internal.Xaml.XamlContext.GetXamlType(XamlTypeName typeName, Boolean 
returnUnknownTypesOnFailure, Boolean skipVisibilityCheck) at 
MS.Internal.Xaml.XamlContext.ResolveXamlType(String qName, Boolean 
skipVisibilityCheck) at 
MS.Internal.Xaml.Context.ObjectWriterContext.ServiceProvider_Resolve(String 
qName) at System.Windows.PropertyPath.ResolvePropertyName(String name, Object 
item, Type ownerType, Object context, Boolean throwOnError) at 
System.Windows.PropertyPath.ResolvePathParts(ITypeDescriptorContext 
typeDescriptorContext) at System.Windows.PropertyPath..ctor(String path, 
ITypeDescriptorContext typeDescriptorContext) at 
System.Windows.PropertyPathConverter.ConvertFrom(ITypeDescriptorContext 
typeDescriptorContext, CultureInfo cultureInfo, Object source) at 
MS.Internal.Xaml.Runtime.ClrObjectRuntime.CallProvideValue(MarkupExtension me, 
IServiceProvider serviceProvider) --- End of inner exception stack trace --- at 
System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo 
lineInfo, Uri baseUri) at 
System.Windows.Markup.XamlReader.RewrapException(Exception e, Uri baseUri) at 
System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, 
XamlObjectWriter currentWriter) at 
System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(DependencyObject 
container, IComponentConnector componentConnector, IStyleConnector 
styleConnector, List`1 affectedChildren, UncommonField`1 
templatedNonFeChildrenField) at 
System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 
affectedChildren) at 
System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, 
DependencyObject container, FrameworkElementFactory templateRoot, Int32 
lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate 
frameworkTemplate) at 
System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 
templateDataField, FrameworkElement container) at 
System.Windows.FrameworkElement.ApplyTemplate() at 
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at 
System.Windows.UIElement.Measure(Size availableSize) at 
System.Windows.Controls.StackPanel.StackMeasureHelper(IStackMeasure 
measureElement, IStackMeasureScrollData scrollData, Size constraint) at 
System.Windows.Controls.StackPanel.MeasureOverride(Size constraint) at 
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at 
System.Windows.UIElement.Measure(Size availableSize) at 
MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size 
constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) 
at System.Windows.UIElement.Measure(Size availableSize) at 
System.Windows.Controls.Border.MeasureOverride(Size constraint) at 
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at 
System.Windows.UIElement.Measure(Size availableSize) at 
System.Windows.Controls.Control.MeasureOverride(Size constraint) at 
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at 
System.Windows.UIElement.Measure(Size availableSize) at 
System.Windows.Controls.Grid.MeasureOverride(Size constraint) at 
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at 
System.Windows.UIElement.Measure(Size availableSize) at 
MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size 
constraint) at System.Windows.FrameworkElement.MeasureCore(Size availableSize) 
at System.Windows.UIElement.Measure(Size availableSize) at 
System.Windows.Controls.Decorator.MeasureOverride(Size constraint) at 
System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint) at 
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at 
System.Windows.UIElement.Measure(Size availableSize) at 
System.Windows.Controls.Border.MeasureOverride(Size constraint) at 
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at 
System.Windows.UIElement.Measure(Size availableSize) at 
System.Windows.Window.MeasureOverrideHelper(Size constraint) at 
System.Windows.Window.MeasureOverride(Size availableSize) at 
System.Windows.FrameworkElement.MeasureCore(Size availableSize) at 
System.Windows.UIElement.Measure(Size availableSize) at 
System.Windows.Interop.HwndSource.SetLayoutSize() at 
System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value) at 
System.Windows.Window.SetRootVisualAndUpdateSTC() at 
System.Windows.Window.SetupInitialState(Double requestedTop, Double 
requestedLeft, Double requestedWidth, Double requestedHeight) at 
System.Windows.Window.CreateSourceWindow(Boolean duringShow) at 
System.Windows.Window.ShowHelper(Object booleanBox) at 
System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, 
Object args, Int32 numArgs) at 
System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate 
callback, Object args, Int32 numArgs, Delegate catchHandler) at 
System.Windows.Threading.DispatcherOperation.InvokeImpl() at 
MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj) at 
System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, 
ContextCallback callback, Object state) --- End of stack trace from previous 
location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext 
executionContext, ContextCallback callback, Object state) at 
MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext 
executionContext, ContextCallback callback, Object state) at 
System.Windows.Threading.DispatcherOperation.Invoke() at 
System.Windows.Threading.Dispatcher.ProcessQueue() at 
System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr 
wParam, IntPtr lParam, Boolean& handled) at 
MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr 
lParam, Boolean& handled) at 
MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at 
System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, 
Object args, Int32 numArgs) at 
System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate 
callback, Object args, Int32 numArgs, Delegate catchHandler) at 
System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority 
priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at 
System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate 
method, Object arg) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 
msg, IntPtr wParam, IntPtr lParam) at 
MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at 
System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at 
System.Windows.Application.RunDispatcher(Object ignore) at 
System.Windows.Application.RunInternal(Window window) at 
WpfInstallerTest.App.Main()

This problem may not be limited to the MenuAdv control. It is just the first control I tested.


Attachment: WpfInstallerTest_a5869a18.zip

2 Replies 1 reply marked as answer

LF Linus Fischer January 27, 2025 04:18 PM UTC

I managed to fix the issue myself. It was as simple as adding this line to the .csproj file:


<UseWindowsForms>true</UseWindowsForms>


This is not obvious at all when using WPF Components. I also couldn't find any documentation on this. 


Marked as answer

NS Nithi Sneha Samuel Jeba Kumar Syncfusion Team January 29, 2025 05:08 AM UTC

Hi Linus Fischer,

Glad that you fixed the issue by yourself!

Thank you for sharing your findings. We appreciate your feedback and are planning to include this in our future documentation to assist other users facing similar challenges.

Regards,
Nithi Sneha S


Loader.
Up arrow icon