Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeLoadException in Release using Behaviors with an ICommand #4022

Open
1 of 2 tasks
alove-kahua opened this issue May 12, 2021 · 6 comments
Open
1 of 2 tasks

TypeLoadException in Release using Behaviors with an ICommand #4022

alove-kahua opened this issue May 12, 2021 · 6 comments
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior external ⤴️ Requires an update to an external dependency or due to code outside the Toolkit. help wanted Issues identified as good community contribution opportunities

Comments

@alove-kahua
Copy link

alove-kahua commented May 12, 2021

Describe the bug

Using a Behavior that has an ICommand property fails to run in Release build when using a standard Binding in XAML as such:

<Interactivity:Interaction.Behaviors>
    <Core:EventTriggerBehavior EventName="PointerPressed">
        <Core:InvokeCommandAction Command="{Binding TestCommand}" />
    </Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>

The exception is as follows:

Exception thrown at 0x755FA6E2 (KernelBase.dll) in CommandIssue.exe: WinRT originate error - 0x80131522 : 'System.TypeLoadException: Could not find Windows Runtime type 'System.Windows.Input.ICommand'.
   at System.StubHelpers.WinRTTypeNameConverter.GetTypeFromWinRTTypeName(String typeName, Boolean& isPrimitive)
   at System.StubHelpers.SystemTypeMarshaler.ConvertToManaged(TypeNameNative* pNativeType, Type& managedType)
   at Windows.UI.Xaml.Markup.IXamlType.get_UnderlyingType()
   at Microsoft.Toolkit.Uwp.UI.Controls.Core.Microsoft_Toolkit_Uwp_UI_Controls_Core_XamlTypeInfo.XamlTypeInfoProvider.GetXamlTypeBy'.
onecore\com\combase\winrt\error\restrictederror.cpp(1016)\combase.dll!764711A5: (caller: 76387BB6) ReturnHr(1) tid(10ec) 8007007E The specified module could not be found.
Exception thrown at 0x755FA6E2 (KernelBase.dll) in CommandIssue.exe: WinRT originate error - 0x802B000A : 'Cannot deserialize XBF metadata property list as 'Command' was not found in type 'Microsoft.Xaml.Interactions.Core.InvokeCommandAction'. [Line: 0 Position: 0]'.

This issue does not occur when the WCT is not referenced or if running the Debug build.

  • Is this bug a regression in the toolkit? If so, what toolkit version did you last see it work:

Steps to Reproduce

CommandIssue.zip

  • Can this be reproduced in the Sample App? (Either in a sample as-is or with new XAML pasted in the editor.) If so, please provide custom XAML or steps to reproduce. If not, let us know why it can't be reproduced (e.g. more complex setup, environment, dependencies, etc...)

Steps to reproduce the behavior:

  1. Given the following environment (Sample App w/ XAML)
  2. Build in the Release Configuration.
  3. Start debugging the application from Visual Studio (while still in Release Configuration).
  4. See error

Expected behavior

The exception does not occur and runs correctly.

Screenshots

Environment

NuGet Package(s): 
Microsoft.NETCore.UniversalWindowsPlatform (6.2.12)
Microsoft.Xaml.Behaviors.Uwp.Managed (2.0.1)
Microsoft.Toolkit.Uwp.UI.Controls (7.0.1)

Package Version(s): 

Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [X] May 2020 Update (19041)
- [ ] Insider Build (build number: )

App min and target version:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [X] May 2019 Update (18362)
- [ ] May 2020 Update (19041)
- [ ] Insider Build (xxxxx)

Device form factor:
- [X] Desktop
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT

Visual Studio 
- [ ] 2017 (version: )
- [X] 2019 (version: 16.9.5) 
- [ ] 2019 Preview (version: )

Additional context

Add any other context about the problem here.

@alove-kahua alove-kahua added the bug 🐛 An unexpected issue that highlights incorrect behavior label May 12, 2021
@ghost ghost added the needs triage 🔍 label May 12, 2021
@ghost
Copy link

ghost commented May 12, 2021

Hello alove-kahua, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

@alove-kahua
Copy link
Author

Still fails in 7.0.2.

@Kyaa-dost
Copy link
Contributor

Based on the above repro above i am seeing this error.
Unhandled exception at 0x09185F61 (Windows.UI.Xaml.dll) in CommandIssue.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x0AC7EF48, 0x00000005).

Let's see if any community member can take a look at the code.

@Kyaa-dost Kyaa-dost added the help wanted Issues identified as good community contribution opportunities label May 12, 2021
@alove-kahua
Copy link
Author

alove-kahua commented May 12, 2021

@Kyaa-dost You can get more details if your Debugger type is set for Mixed (Managed and Native) in the project properties.

@curia-damiano
Copy link

Hi, we are facing the same issue, even with Debug builds.

@ghost ghost added the needs attention 👋 label Jun 16, 2021
@CommunityToolkit CommunityToolkit deleted a comment Jul 20, 2021
@CommunityToolkit CommunityToolkit deleted a comment Jul 20, 2021
@michael-hawker michael-hawker added the external ⤴️ Requires an update to an external dependency or due to code outside the Toolkit. label Jul 20, 2021
@michael-hawker
Copy link
Member

I believe this to be the same issue we're tracking with WinUI here, though in that case we're only seeing the issue in Debug mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior external ⤴️ Requires an update to an external dependency or due to code outside the Toolkit. help wanted Issues identified as good community contribution opportunities
Projects
None yet
Development

No branches or pull requests

4 participants