Windowscommunitytoolkit: System.TypeLoadException occurred in Microsoft.Toolkit.Uwp.UI.Controls.dll

Created on 9 Jan 2017  路  46Comments  路  Source: windows-toolkit/WindowsCommunityToolkit

Trying out the HeaderedTextBlock control in the UWP-Community-toolkit, I get
'System.TypeLoadException' occurred in Microsoft.Toolkit.Uwp.UI.Controls.dll
Additional information: Could not find Windows Runtime type 'Windows.UI.Composition.DropShadow'.

StackTrace

   at Microsoft.Toolkit.Uwp.UI.Controls.Microsoft_Toolkit_Uwp_UI_Controls_XamlTypeInfo.XamlTypeInfoProvider.InitTypeTables()
   at Microsoft.Toolkit.Uwp.UI.Controls.Microsoft_Toolkit_Uwp_UI_Controls_XamlTypeInfo.XamlTypeInfoProvider.LookupTypeIndexByName(String typeName)
   at Microsoft.Toolkit.Uwp.UI.Controls.Microsoft_Toolkit_Uwp_UI_Controls_XamlTypeInfo.XamlTypeInfoProvider.GetXamlTypeByName(String typeName)
   at Microsoft.Toolkit.Uwp.UI.Controls.Microsoft_Toolkit_Uwp_UI_Controls_XamlTypeInfo.XamlMetaDataProvider.GetXamlType(String fullName)
   at Test_uwp.Test_uwp_XamlTypeInfo.XamlTypeInfoProvider.CheckOtherMetadataProvidersForName(String typeName)
   at Test_uwp.Test_uwp_XamlTypeInfo.XamlTypeInfoProvider.GetXamlTypeByName(String typeName)
   at Test_uwp.App.GetXamlType(String fullName)

Where
typeName: Windows.UI.Composition.DropShadow and
fullName: Microsoft.Toolkit.Uwp.UI.Controls.HamburgerMenu

_Where is HamburgerMenu even coming from?_

MainPage.xaml

<Page
x:Class="Test_uwp.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Test_uwp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d">

    <Grid>
        <controls:HeaderedTextBlock 
            Header="Name"
            Text="UWP Toolkit"
            Orientation="Vertical"
            Margin="20,10,0,0" />
    </Grid>
</Page>

MainPage.xaml.cs

namespace Test_uwp
{
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
        }
    }
}

I got the same exception with RadialGuage.
Toolkit version: 1.2.0

bug controls

Most helpful comment

People, this issue is still present. To date, the only workaround is to install the Windows 10 SDK 14393 (Anniversary Update). @nmetulev @imprakhar7 @axelriet

All 46 comments

can you upload a repro ?

can't reproduce it.
repro

what version of windows 10 are you using for dev ?

Hmm..
Windows 10 Pro Insider Preview Build 14951.

I am on public release.. can you create any type of VS project.. plain simple.. run it.

then add Toolkit and type again ?

  • Create new empty uwp project
  • Run it. Works
  • Go to Manage Nuget Packges and add Microsoft.Toolkit.Uwp.UI.Controls 1.2.0
  • Run it again. Works
  • Add simple HeaderedTextBlock code in MainPage.xaml
  • Run it again. Does not work. Same exception as above

What is the version of UniversalWindowsPlatform ? can you try 5.2.2 ? not really sure what the problem is

Was using 5.0.0.
No difference with 5.2.2

which sdk version are you using?

10.0.10586.0

I have my Surface on Preview build, I can try after work.

PS: Which version of VS are you running?

Microsoft Visual Studio Enterprise 2015, Version 14.0.25123.00 Update 2

Really weird. Cannot reproduce either
@Code-ScottLe did you try on preview build?

@achabill Can you try to update it to the lastest update (Update 3?)

https://www.visualstudio.com/en-us/news/releasenotes/vs2015-update3-vs

@deltakosh I realized that I did not have 2015 and 10586 SDK on my Preview Build (running 2017 RC on that one), got it set up yesterday but didn't have time to test it. I will do it today.

OK. I'll update and report tomorrow.
I also mentioned that I had the same exception with RadialGuage because that's what I really want to use.
I then found this by @XamlBrewer .
It throws the same exception except that typename is not HamburgerMenu.
Don't know if this helps.

I can't get 2015 to work properly on my Surface. But i did try on 2017 RC and it works just fine. My build is 14986. It is very hard to say since you are also running an out-of-date build. I will try to wiggle 2015 to see if it will work and report back.

I can't reproduce on VS 2015.3 from my Surface either. This might be related to your older preview version. Please update the preview build and let us know.

Cannot reproduce either. Let's wait for @achabill to update to update3

Ping?

Update crashed and did not complete. Lost UWP tools as a result. I'm trying again.

Sorry for the delay.
It works now.

  • VS Enterprise 2015 update 2 to VS Community 2015 Update 3
  • Downgrade from Windows 10 Insider preview build 14951 to Windows 10 version 1607 build 14393 public release.

Tested RadialGuage and HeaderTextBlock

Excellent news! Thanks for the follow up:)

I'm getting this one again! Under Windows 10 Creators Update

Steps to reproduce:

  1. Create New Proyect => Universal Windows Platform
  2. Target Windows 10 build 10586 (Minimum version, the same).
  3. Add a HeaderedTextBlock to MainWindow.xaml
  4. Run

You should get:

image

image

The only way to avoid this exception is changing the Target version to "Creators Update"

Tried to reproduce with your steps but no such luck. Do you have a repro you can share?
image

Are you trying on Windows 10 Creators Update?

Are you using the nugets or with the source code?

Great question. I used the nuget on 15063 (Creators Update)

The only thing I can think of that you could have forgotten is the Target in the project, that should be 10586.

Anyways, I'm reinstalling W10 Creators Update and VS 2017. I will try to reproduce the problem on a freshly installed system.

OK. I have seen that you set the target. Sorry. I will see if reinstalling everything solves the issue.

Still happens!

captura

This is in a Freshly Installed Windows 10 Creators Update and VS 2017 (updated to latest, too). Please, reproduce it in the attached solution => UWPToolkitIssue.zip

Ping! Anyone?

@SuperJMN, I apologize, I tried your project and could not replicate the issue. I'm on the exact same OS build and VS. Out of curiosity, does this happen with older versions of the toolkit?

What you could do, after cleaning the solution (clearing both the bin and obj folder). Clone the repo, and then manually adding the project into your existing solution and then try to run again. If it fails somewhere in the toolkit, we have a better chance to narrow it down.

@Code-ScottLe which branch should I check out? dev or master?

@nmetulev Interestingly enough, the only version that works OK is 1.0.0 (the oldest version in NuGet). The rest, fail saying the same.

Aha, I finally made it work! As soon as I installed the Windows 10 SDK 14393 (Anniversary Update), it ran perfectly. Without that SDK, it died.

Thanks for the update, that is great to know, I'm glad it worked out

Facing similar problem and I can not upgrade to Anniversary edition. Anyone has any other solution.

capture1

Hey @imprakhar7 , what build are you on? Can you share a repro?

Hi @nmetulev , Sorry I cant share repo. I am using windows enterprise 10.0.10586.

project.json

{
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.2.3",
"Microsoft.Toolkit.Uwp": "1.4.1",
"Microsoft.Toolkit.Uwp.UI": "1.4.1",
"Microsoft.Toolkit.Uwp.UI.Controls": "1.4.1",
"MyToolkit.Extended": "2.5.16",
"SQLite.Net-PCL": "3.1.1",
"System.Data.SQLite": "1.0.105.1",
"WinUX.UWP": "2.4.17005.1"
},
"frameworks": {
"uap10.0": {}
},
"runtimes": {
"win10-arm": {},
"win10-arm-aot": {},
"win10-x86": {},
"win10-x86-aot": {},
"win10-x64": {},
"win10-x64-aot": {}
}
}

Without being able to reproduce this issue, I'm afraid there is not much we can do. Can you create a simple repro that you can share?

"Microsoft.Toolkit.Uwp.UI.Controls": "1.4.1" - same problem here. Such a brittle little platform. Everything I try seems to break one way or another. I think I'd more productive writing assembly code on the bare metal :-)

:(, do you have a quick repro sample you can share? Could you also share details about your setup (osversion, vs version, sdk targets, etc)

People, this issue is still present. To date, the only workaround is to install the Windows 10 SDK 14393 (Anniversary Update). @nmetulev @imprakhar7 @axelriet

Once I change the target version of my project to: Windows 10 (10.0; Build 10586)
I'm getting:
Cannot find type Windows.UI.Composition.DropShadow in module Windows.Foundation.UniversalApiContract.winmd

If I switch to Windows 10 Creators Update(10.0; Build 15063) It works and there is no problem.
Link to my repo: https://github.com/COM8/UWP-TUM-Campus-App/blob/master/TUMCampusApp/pages/HomePage.xaml

AFAIK, this is caused by ApiInformation and how the check is done on the platform side. ApiInformation runs against the OS version, not the target version of the app.

Was this page helpful?
0 / 5 - 0 ratings