Skip to content

[dotnet-sdk-11.0.100-preview.4.26210.111] CastIt fails to launch with Unhandled exception System.Windows.Markup.XamlParseException #11576

@Junjun-zhao

Description

@Junjun-zhao

Description

When we launch CastIt with the latest build dotnet-sdk-11.0.100-preview.4.26210.111, it failed with an error: Unhandled exception. System.Windows.Markup.XamlParseException.

Reproduction Steps

Only Install dotnet-sdk-11.0.100-preview.4.26210.111 on your machine. You can also refer to repro machine at Devdiv bug
1.Open Command Prompt.
2.Navigate to the CastIt directory: cd "C:\Users\test01\Desktop\CastIt"
3.Ensure the runtime configuration file contains the following runtimeOptions:

{
  "runtimeOptions": {
    "tfm": "net8.0",
    "frameworks": [
      {
        "name": "Microsoft.NETCore.App",
        "version": "11.0.0-preview.4.26210.111"
      },
      {
        "name": "Microsoft.WindowsDesktop.App",
        "version": "11.0.0-preview.4.26210.111"
      }
    ],
    "configProperties": {
      "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": true,
      "CSWINRT_USE_WINDOWS_UI_XAML_PROJECTIONS": false
    }
  }
}

4.Run "dotnet CastIt.dll".

Expected behavior

Launch successfully.

Actual behavior

Launch failed.

Unhandled exception. System.Windows.Markup.XamlParseException: 'Initialization of 'CastIt.MainWindow' threw an exception.' Line number '43' and line position '13'.
 ---> MvvmCross.Exceptions.MvxIoCResolveException: Failed to construct AppDataService
 ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.InvalidOperationException: Multiple constructors accepting all given argument types have been found in type 'FluentMigrator.Runner.DefaultConventionSet'. There should only be one applicable constructor.
   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.TryFindMatchingConstructor(Type instanceType, Type[] argumentTypes, ConstructorInfo& matchingConstructor, Nullable`1[]& parameterMap)
   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.FindApplicableConstructor(Type instanceType, Type[] argumentTypes, ConstructorInfoEx[] constructors, ConstructorInfo& matchingConstructor, Nullable`1[]& matchingParameterMap)   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
   at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance[T](IServiceProvider provider, Object[] parameters)
   at Microsoft.Extensions.DependencyInjection.FluentMigratorServiceCollectionExtensions.<>c.<AddFluentMigratorCore>b__0_3(IServiceProvider sp)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(IServiceCallSite callSite, ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass22_0.<RealizeService>b__0(ServiceProvider provider)
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at CastIt.Services.AppDataService.ApplyMigrations() in D:\CastIt\CastIt\Services\AppDataService.cs:line 183
   at CastIt.Services.AppDataService..ctor(IMapper mapper) in D:\CastIt\CastIt\Services\AppDataService.cs:line 30
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Constructor(Object obj, IntPtr* args)
   at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)
   at MvvmCross.IoC.MvxIoCContainer.IoCConstruct(Type type, ConstructorInfo constructor, Object[] arguments)
   --- End of inner exception stack trace ---
   at MvvmCross.IoC.MvxIoCContainer.IoCConstruct(Type type, ConstructorInfo constructor, Object[] arguments)
   at MvvmCross.IoC.MvxIoCContainer.IoCConstruct(Type type, IDictionary`2 arguments)
   at MvvmCross.IoC.MvxIoCContainer.IoCConstruct(Type type)
   at MvvmCross.IoC.MvxIoCContainer.IoCConstruct[T]()
   at MvvmCross.IoC.MvxIoCProvider.IoCConstruct[T]()
   at MvvmCross.IoC.MvxIoCContainerExtensions.ConstructAndRegisterSingleton[TInterface,TType](IMvxIoCProvider ioc)
   at CastIt.Application.Initialize() in D:\CastIt\CastIt\Application.cs:line 34
   at MvvmCross.Core.MvxSetup.InitializeApp(IMvxPluginManager pluginManager, IMvxApplication app)
   at MvvmCross.Core.MvxSetup.InitializeSecondary()
   at MvvmCross.Core.MvxSetupSingleton.<StartSetupInitialization>b__13_0()
   at MvvmCross.Core.MvxSetupSingleton.EnsureInitialized()
   at MvvmCross.Platforms.Wpf.Views.MvxApplication.ApplicationInitialized()
   at MvvmCross.Platforms.Wpf.Views.MvxWindow.MvxWindow_Initialized(Object sender, EventArgs e)
   at MS.Internal.Xaml.Runtime.ClrObjectRuntime.InitializationGuard(XamlType xamlType, Object obj, Boolean begin)
   --- 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.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)
   at System.Windows.Application.DoStartup()
   at System.Windows.Application.<.ctor>b__1_0(Object unused)
   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 CastIt.App.Main()
   at System.Environment.CallEntryPoint(IntPtr entryPoint, String[]* pArgument, Int32* pReturnValue, Boolean captureException, Exception* pException)

Regression?

Yes

Verify Scenarios:
1). Windows 11 24H2 AMD64 + dotnet-sdk-11.0.100-preview.3.26207.106: Pass
2). Windows 11 24H2 AMD64 + dotnet-sdk-11.0.100-preview.4.26210.111: Fail

Known Workarounds

No response

Impact

No response

Configuration

Application Name: CastIt
OS: Windows 11 25H2
CPU: X64
.NET Build Number: dotnet-sdk-11.0.100-preview.4.26210.111
App Source checking at : https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2931914
dotnet --info

.NET SDK:
 Version:           11.0.100-preview.4.26210.111
 Commit:            5bed4499b0
 Workload version:  11.0.100-manifests.a54d0309
 MSBuild version:   18.6.0-preview-26210-111+5bed4499b

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.26200
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\11.0.100-preview.4.26210.111\

Host:
  Version:      11.0.0-preview.4.26210.111
  Architecture: x64
  Commit:       5bed4499b0

.NET SDKs installed:
  11.0.100-preview.4.26210.111 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 11.0.0-preview.4.26210.111 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 11.0.0-preview.4.26210.111 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 11.0.0-preview.4.26210.111 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other information

@dotnet-actwx-bot @dotnet/compat

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions