dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.21k stars 1.75k forks source link

CreateContainer possible Bug in Windows #7718

Open danardelean opened 2 years ago

danardelean commented 2 years ago

Description

I am trying to replace the default container implementation in MAUI with a Unity Container. On iOS and Android it seems to work ok but on Windows I have an unhandled exception when it tries to resolve: Resolve Microsoft.Extensions.Logging.ILogger`1[Microsoft.Maui.IImageSource]

Steps to Reproduce

I am attaching the test project: MauiApp9.zip t

Version with bug

6.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

All

Did you find any workaround?

No

Relevant log output

No response

kristinx0211 commented 2 years ago

see this error when run on windows, work ok on android.

'MauiApp9.exe' (CoreCLR: DefaultDomain): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\MauiApp9.dll'. Symbols loaded.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\WinRT.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.Runtime.InteropServices.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.Collections.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.Collections.Concurrent.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.Threading.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.WinUI.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.Runtime.CompilerServices.Unsafe.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.Private.Uri.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.ObjectModel.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.ComponentModel.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.Numerics.Vectors.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.Security.Cryptography.Algorithms.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.Security.Cryptography.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.Security.Cryptography.Csp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.Linq.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.Memory.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.InteractiveExperiences.Projection.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Maui.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Windows.SDK.NET.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Maui.Controls.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Extensions.DependencyInjection.Abstractions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\Unity.Container.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\Unity.Abstractions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Maui.Essentials.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Maui.Controls.Xaml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Maui.Graphics.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\CommunityToolkit.Mvvm.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Extensions.Logging.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\netstandard.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Extensions.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Extensions.Configuration.Abstractions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Extensions.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.Runtime.Extensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.Xml.ReaderWriter.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.Private.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.Net.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Extensions.Logging.Abstractions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.ComponentModel.TypeConverter.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Maui.Graphics.Win2D.WinUI.Desktop.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Extensions.Options.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Extensions.DependencyInjection.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Resolve Microsoft.Maui.Dispatching.IDispatcher
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.Linq.Expressions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.Reflection.Emit.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'Snippets'. 
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Maui.Controls.Compatibility.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Resolve System.Collections.Generic.IEnumerable`1[Microsoft.Maui.Hosting.IMauiInitializeScopedService]
Resolve Microsoft.Maui.Dispatching.IDispatcher
Resolve Microsoft.Maui.LifecycleEvents.ILifecycleEventService
Resolve Microsoft.Maui.IApplication
'MauiApp9.exe' (CoreCLR: clrhost): Loaded 'D:\4\MauiApp9\MauiApp9\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\AppX\System.Runtime.Loader.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Resolve Microsoft.Maui.IMauiHandlersFactory
Resolve Microsoft.Maui.LifecycleEvents.ILifecycleEventService
Resolve Microsoft.Maui.LifecycleEvents.ILifecycleEventService
Resolve Microsoft.Maui.LifecycleEvents.ILifecycleEventService
Resolve Microsoft.Maui.LifecycleEvents.ILifecycleEventService
Resolve Microsoft.Maui.LifecycleEvents.ILifecycleEventService
Resolve Microsoft.Maui.LifecycleEvents.ILifecycleEventService
Resolve Microsoft.Maui.LifecycleEvents.ILifecycleEventService
Resolve Microsoft.Maui.LifecycleEvents.ILifecycleEventService
Resolve Microsoft.Maui.LifecycleEvents.ILifecycleEventService
Resolve Microsoft.Maui.LifecycleEvents.ILifecycleEventService
Resolve Microsoft.Maui.LifecycleEvents.ILifecycleEventService
Resolve Microsoft.Extensions.DependencyInjection.IServiceScopeFactory
Resolve Microsoft.Maui.LifecycleEvents.ILifecycleEventService
Resolve Microsoft.Maui.IMauiHandlersFactory
Resolve Microsoft.Maui.LifecycleEvents.ILifecycleEventService
Resolve Microsoft.Maui.IMauiHandlersFactory
Resolve Microsoft.Maui.IMauiHandlersFactory
Resolve Microsoft.Extensions.Logging.ILogger`1[Microsoft.Maui.IImageSource]
The program '[23900] MauiApp9.exe' has exited with code 3221226107 (0xc000027b).
XamlTest commented 1 year ago

Verified this on Visual Studio Enterprise 17.6.0 Preview 7.0. Repro on Windows 11 with below Project: 7718.zip