Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] WPF runtime issue #10489

Closed
VladislavAntonyuk opened this issue Apr 28, 2020 · 9 comments · Fixed by #11910
Closed

[Bug] WPF runtime issue #10489

VladislavAntonyuk opened this issue Apr 28, 2020 · 9 comments · Fixed by #11910
Labels
a/buildchain e/5 🕔 5 in-progress This issue has an associated pull request that may resolve it! p/WPF t/bug 🐛
Milestone

Comments

@VladislavAntonyuk
Copy link
Contributor

VladislavAntonyuk commented Apr 28, 2020

Description

FileNotFoundException: Could not load file or assembly 'Xamarin.Forms.Platform.WPF, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

Steps to Reproduce

  1. Create netcoreapp5.0 app or netcoreapp3.1
  2. restore nuget packages (Xamarin.Forms, Xamarin.Forms.Platform.WPF)
  3. Create MainPage OnStart
var page = new ContentPage();
            var stack = new StackLayout();
            stack.Children.Add(new Label() { Text = "12" });
            page.Content = stack;
            MainPage = new NavigationPage(page);
  1. Maximize window

Expected Behavior

app runs

Actual Behavior

content is not rendered
crash

   at System.Windows.FrameworkElement.ChangeLogicalParent(DependencyObject newParent)
   at System.Windows.FrameworkElement.AddLogicalChild(Object child)
   at System.Windows.Controls.UIElementCollection.AddInternal(UIElement element)
   at System.Windows.Controls.UIElementCollection.Add(UIElement element)
   at Xamarin.Forms.Platform.WPF.ScrollViewRenderer.LoadContent()
   at Xamarin.Forms.Platform.WPF.ScrollViewRenderer.OnElementChanged(ElementChangedEventArgs`1 e)
   at Xamarin.Forms.Platform.WPF.ViewRenderer`2.SetElement(VisualElement element)
   at Xamarin.Forms.Platform.WPF.Platform.CreateRenderer(VisualElement element)
   at Xamarin.Forms.Platform.WPF.LayoutRenderer.<>c__DisplayClass4_0.<HandleChildAdded>b__0()
   at Xamarin.Forms.Platform.WPF.Helpers.UiHelper.ExecuteInUiThread(Action action)
   at Xamarin.Forms.Platform.WPF.LayoutRenderer.HandleChildAdded(Object sender, ElementEventArgs e)
   at Xamarin.Forms.Platform.WPF.LayoutRenderer.OnElementChanged(ElementChangedEventArgs`1 e)
   at Xamarin.Forms.Platform.WPF.ViewRenderer`2.SetElement(VisualElement element)
   at Xamarin.Forms.Platform.WPF.Platform.CreateRenderer(VisualElement element)
   at Xamarin.Forms.Platform.WPF.LayoutRenderer.<>c__DisplayClass4_0.<HandleChildAdded>b__0()
   at Xamarin.Forms.Platform.WPF.Helpers.UiHelper.ExecuteInUiThread(Action action)
   at Xamarin.Forms.Platform.WPF.LayoutRenderer.HandleChildAdded(Object sender, ElementEventArgs e)
   at Xamarin.Forms.Platform.WPF.LayoutRenderer.OnElementChanged(ElementChangedEventArgs`1 e)
   at Xamarin.Forms.Platform.WPF.ViewRenderer`2.SetElement(VisualElement element)
   at Xamarin.Forms.Platform.WPF.Platform.CreateRenderer(VisualElement element)
   at Xamarin.Forms.Platform.WPF.Platform.GetOrCreateRenderer(VisualElement element)
   at Xamarin.Forms.Platform.WPF.PageRenderer.UpdateContent()
   at Xamarin.Forms.Platform.WPF.PageRenderer.OnElementChanged(ElementChangedEventArgs`1 e)
   at Xamarin.Forms.Platform.WPF.ViewRenderer`2.SetElement(VisualElement element)
   at Xamarin.Forms.Platform.WPF.Platform.CreateRenderer(VisualElement element)
   at Xamarin.Forms.Platform.WPF.Platform.GetOrCreateRenderer(VisualElement element)
   at Xamarin.Forms.Platform.WPF.FormsContentLoader.CreateOrResizeContent(FrameworkElement parent, VisualElement visualElement)
   at Xamarin.Forms.Platform.WPF.FormsContentLoader.OnSizeContentChanged(FrameworkElement parent, Object page)
   at Xamarin.Forms.Platform.WPF.Controls.FormsContentControl.LightContentControl_SizeChanged(Object sender, SizeChangedEventArgs e)
   at System.Windows.SizeChangedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
   at System.Windows.FrameworkElement.OnRenderSizeChanged(SizeChangedInfo sizeInfo)
   at System.Windows.ContextLayoutManager.fireSizeChangedEvents()
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.UIElement.UpdateLayout()
   at System.Windows.Interop.HwndSource.Process_WM_SIZE(UIElement rootUIElement, IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam)
   at System.Windows.Interop.HwndSource.LayoutFilterMessage(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.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.HwndSubclass.DefWndProcWrapper(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

Basic Information

  • Nuget Packages: 4.8.0-740-nightly
@VladislavAntonyuk VladislavAntonyuk added s/unverified New report that has yet to be verified t/bug 🐛 labels Apr 28, 2020
@pauldipietro pauldipietro added this to New in Triage Apr 28, 2020
@hartez
Copy link
Contributor

hartez commented Apr 28, 2020

You need to use a .NET Framework WPF app with Forms.

@VladislavAntonyuk
Copy link
Contributor Author

@hartez there was a PR to update allow use .NET CORE with WPF

@hartez
Copy link
Contributor

hartez commented Apr 28, 2020

@VladislavAntonyuk You are correct. And the PR was merged on the 15th, and that nightly was built on the 23rd. So the support should be there.

@hartez hartez added e/5 🕔 5 and removed s/unverified New report that has yet to be verified labels Apr 28, 2020
@hartez hartez added this to To do in Other Ready For Work via automation Apr 28, 2020
@hartez hartez removed this from New in Triage Apr 28, 2020
@VladislavAntonyuk
Copy link
Contributor Author

@hartez I updated to 4.8 build, and was able to run the app, but the content is not rendered and on window maximize app crashes.
the same code for net462 works

@VladislavAntonyuk
Copy link
Contributor Author

#2704

@samhouts samhouts added this to the 5.0.0 milestone Aug 13, 2020
@samhouts samhouts added this to To do in vNext+1 (5.0.0) Aug 13, 2020
@PureWeen
Copy link
Contributor

@VladislavAntonyuk Can you confirm if the PR you did here worked for you when running the WPF ControlGallery?

#10736

Currently the WPF Gallery doesn't run it just crashes with a cannot find dll error.

The gallery works fine before #10736 but not after it so I wonder if the netcoreapp3.1 targets have ever really worked

@VladislavAntonyuk
Copy link
Contributor Author

It worked on my dev env. I also use net5 now with nightly build for wpf and it works

@VladislavAntonyuk
Copy link
Contributor Author

I decided not to close it because we have an issue with ControlGallery. But I still can build and execute it locally. Could it be some kind of cached data?

@VladislavAntonyuk
Copy link
Contributor Author

Well I see, modify line 3 of csproj to netcoreapp3.1 (remove net461) and now it works. But works fine with net5.0

@samhouts samhouts added the in-progress This issue has an associated pull request that may resolve it! label Sep 3, 2020
@samhouts samhouts added this to In Progress in .NET MAUI Backlog Sep 3, 2020
@samhouts samhouts moved this from To do to In progress in Other Ready For Work Sep 3, 2020
@samhouts samhouts added this to In Progress in vCurrent (4.8.0) Sep 3, 2020
@samhouts samhouts modified the milestones: 5.0.0, 4.8.0 Sep 9, 2020
@samhouts samhouts removed this from To do in vNext+1 (5.0.0) Sep 9, 2020
@samhouts samhouts removed this from Done in .NET MAUI Backlog Nov 4, 2020
@samhouts samhouts added this to In Progress in .NET MAUI Backlog Nov 4, 2020
@samhouts samhouts moved this from In Progress to Done in .NET MAUI Backlog Nov 4, 2020
@samhouts samhouts removed this from Done in .NET MAUI Backlog Nov 4, 2020
@samhouts samhouts added this to In Progress in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts moved this from In Progress to Done in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts removed this from Done in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts added this to In Progress in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts moved this from In Progress to Done in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts removed this from Done in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts added this to In Progress in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts moved this from In Progress to Done in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts removed this from Done in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts added this to In Progress in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts moved this from In Progress to Done in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts removed this from Done in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts added this to In Progress in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts moved this from In Progress to Done in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts removed this from Done in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts added this to In Progress in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts moved this from In Progress to Done in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts removed this from Done in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts added this to In Progress in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts moved this from In Progress to Done in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts removed this from Done in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts added this to In Progress in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts moved this from In Progress to Done in .NET MAUI Backlog Nov 5, 2020
@samhouts samhouts removed this from Done in .NET MAUI Backlog Nov 5, 2020
shyunMin pushed a commit to shyunMin/Xamarin.Forms that referenced this issue Feb 19, 2021
 fixes xamarin#10489

* Add assembly version infos

* Update Xamarin.Forms.Platform.WPF/Properties/AssemblyInfo.cs

Co-authored-by: Rui Marinho <me@ruimarinho.net>
Axemasta pushed a commit to Axemasta/Xamarin.Forms that referenced this issue Apr 5, 2021
 fixes xamarin#10489

* Add assembly version infos

* Update Xamarin.Forms.Platform.WPF/Properties/AssemblyInfo.cs

Co-authored-by: Rui Marinho <me@ruimarinho.net>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/buildchain e/5 🕔 5 in-progress This issue has an associated pull request that may resolve it! p/WPF t/bug 🐛
Projects
Other Ready For Work
  
In progress
Development

Successfully merging a pull request may close this issue.

5 participants