unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
8.95k stars 726 forks source link

Unable to find `MetadataUpdater` when targeting .NET Core 3.1 #10581

Closed MartinZikmund closed 1 year ago

MartinZikmund commented 1 year ago

Current behavior

When targeting ,NET Core 3.1, the Skia targets throw an exception during startup:

Unable to find System.Reflection.Metadata.MetadataUpdater
at Uno.UI.RemoteControl.HotReload.MetadataUpdater.HotReloadAgent..ctor(Action`1 log) in C:\Dev\uno2\src\Uno.UI.RemoteControl\HotReload\MetadataUpdater\MetadataUpdaterAgent.cs:line 65
   at Uno.UI.RemoteControl.HotReload.ClientHotReloadProcessor.InitializeMetadataUpdater() in C:\Dev\uno2\src\Uno.UI.RemoteControl\HotReload\ClientHotReloadProcessor.MetadataUpdate.cs:line 42
   at Uno.UI.RemoteControl.HotReload.ClientHotReloadProcessor..ctor(IRemoteControlClient rcClient) in C:\Dev\uno2\src\Uno.UI.RemoteControl\HotReload\ClientHotReloadProcessor.cs:line 27
   at Uno.UI.RemoteControl.RemoteControlClient..ctor(Type appType) in C:\Dev\uno2\src\Uno.UI.RemoteControl\RemoteControlClient.cs:line 66
   at Uno.UI.RemoteControl.RemoteControlClient.Initialize(Type appType) in C:\Dev\uno2\src\Uno.UI.RemoteControl\RemoteControlClient.cs:line 335
   at SamplesApp.App.InitializeComponent_0() in C:\Dev\uno2\src\SamplesApp\SamplesApp.Skia\obj\Debug\netstandard2.0\g\XamlCodeGenerator\App_82e39f229d34606fa76cb3b279c186ad.g.cs:line 57
   at SamplesApp.App.InitializeComponent() in C:\Dev\uno2\src\SamplesApp\SamplesApp.Skia\obj\Debug\netstandard2.0\g\XamlCodeGenerator\App_82e39f229d34606fa76cb3b279c186ad.g.cs:line 52
   at SamplesApp.App..ctor() in C:\Dev\uno2\src\SamplesApp\SamplesApp.Shared\App.xaml.cs:line 82
   at SamplesApp.WPF.MainWindow.<>c.<.ctor>b__0_0() in C:\Dev\uno2\src\SamplesApp\SamplesApp.Skia.WPF\MainWindow.xaml.cs:line 29
   at Uno.UI.Skia.Platform.WpfHost.<StartApp>g__CreateApp|29_0(ApplicationInitializationCallbackParams _) in C:\Dev\uno2\src\Uno.UI.Runtime.Skia.Wpf\WpfHost.cs:line 271
   at Windows.UI.Xaml.Application.StartPartial(ApplicationInitializationCallback callback) in C:\Dev\uno2\src\Uno.UI\UI\Xaml\Application.skia.cs:line 83
   at Windows.UI.Xaml.Application.Start(ApplicationInitializationCallback callback) in C:\Dev\uno2\src\Uno.UI\UI\Xaml\Application.cs:line 250
   at Windows.UI.Xaml.Application.StartWithArguments(ApplicationInitializationCallback callback) in C:\Dev\uno2\src\Uno.UI\UI\Xaml\Application.skia.cs:line 72
   at Uno.UI.Skia.Platform.WpfHost.StartApp() in C:\Dev\uno2\src\Uno.UI.Runtime.Skia.Wpf\WpfHost.cs:line 275
   at Uno.UI.Skia.Platform.WpfHost.OnApplyTemplate() in C:\Dev\uno2\src\Uno.UI.Runtime.Skia.Wpf\WpfHost.cs:line 264
   at System.Windows.FrameworkElement.ApplyTemplate()
   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.Controls.ContentPresenter.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 MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(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.Interop.HwndSource.set_RootVisual(Visual value)
   at System.Windows.Window.SetRootVisual()
   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.CreateSourceWindowDuringShow()
   at System.Windows.Window.SafeCreateWindowDuringShow()
   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 System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   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 System.Threading.ExecutionContext.Run(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 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.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run()
   at SamplesApp.WPF.App.Main()

Expected behavior

Should not throw

How to reproduce it (as minimally and precisely as possible)

No response

Workaround

Use newer .NET version.

Works on UWP/WinUI

Yes

Environment

No response

NuGet package version(s)

No response

Affected platforms

No response

IDE

No response

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

No response

MartinZikmund commented 1 year ago

CC @jeromelaban