CommunityToolkit/WindowsCommunityToolkit

IXamlMetadataContainer missing when dragging item from toolbox onto winforms (Framework) from

Open

#3,376 建立於 2020年7月2日

在 GitHub 查看
 (8 留言) (0 反應) (0 負責人)C# (1,403 fork)batch import
XamlIslands :desert_island:bug :bug:help wanted

倉庫指標

Star
 (5,708 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

Describe the bug

When trying to drag a control from the Visual Studio toolbox onto a WinForms' form, this error message pops up:

Microsoft Visual Studio

Failed to create component 'WindowsXamlHost'.  The error message follows:

 'System.TypeLoadException: Could not find Windows Runtime type 'Microsoft.Toolkit.Win32.UI.XamlHost.IXamlMetadataContainer'.
   at Microsoft.Toolkit.Forms.UI.XamlHost.WindowsXamlHostBase..cctor()'

Steps to Reproduce

Steps to reproduce the behavior:

  1. I'm following this walkthrough: https://docs.microsoft.com/en-us/windows/apps/desktop/modernize/host-standard-control-with-xaml-islands
  2. After creating a WinForms (.net framework 4.7.2) project, and adding a reference to the Microsoft.Toolkit.Forms.UI.Controls 6.1.0 NuGet package. I added the x86 project configuration to the WinForms project.
  3. When I drag a control onto the form (specifically, the InkCavas, but it happens with all the Toolkit controls in the toolbox) and I see the error described before.

Expected behavior

The control should appear, as it did in the WPF (core 3.1) project.

Environment

NuGet Package(s): 
Microsoft.Toolkit.Forms.UI.Controls
Package Version(s): 
6.1.0 

Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [x] October 2019 Update (1909, 18363.900)
- [ ] Insider Build (build number: )

App min and target version:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] Insider Build (xxxxx)
-- i don't know where to find that

Device form factor:
- [x] Desktop (Surface book 1)
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT

Visual Studio 
- [ ] 2017 (version: )
- [ ] 2019 (version: ) 
- [x] 2019 Preview (version: 16.7.0 Preview 3.1)

貢獻者指南