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

System.Runtime.InteropServices.COMException: The application called an interface that was marshalled for a different thread. #9208

Closed
ghost opened this issue Jan 5, 2024 · 5 comments
Labels
bug Something isn't working team-Markup Issue for the Markup team

Comments

@ghost
Copy link

ghost commented Jan 5, 2024

Describe the bug

System.Runtime.InteropServices.COMException: The application called an interface that was marshalled for a different thread.

WinUI3 app crashing before exiting the initial App() constructor.

I've not been able to resolve this with the comments from the past similar issues #8920, #616 and #308.

Here is a solution that gives the problem listed in this issue https://github.com/dfmacom/Broken-WinRT-Issue9208

A couple exception messages I've recieved:

  1. "System.Runtime.InteropServices.COMException HResult=0x8001010E Message=The application called an interface that was marshalled for a different thread. Source=System.Private.CoreLib StackTrace: at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs"

  2. "System.Runtime.InteropServices.COMException HResult=0x8001010E Message=The application called an interface that was marshalled for a different thread. Source=System.Private.CoreLib StackTrace:
    at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
    at WinRT.BaseActivationFactory._ActivateInstanceI
    at WinRT.ActivationFactory`1.ActivateInstanceI
    at Microsoft.UI.Xaml.Controls.XamlControlsResources..ctor()
    at [projname]_XamlTypeInfo.XamlTypeInfoProvider.Activate_0_XamlControlsResources() in ..\obj\x64\Debug\net8.0-windows10.0.19041.0\XamlTypeInfo.g.cs:line 504"

    • note line 504 in error message (2) is
      return new global::Microsoft.UI.Xaml.Controls.XamlControlsResources();

Nuget Packages installed:
windowsappsdk\1.4.231115000
microsoft.ui.xaml\2.8.6
communitytoolkit.winui\7.1.2
communitytoolkit.winui.behaviors\8.0.230907
communitytoolkit.winui.ui.animations\7.1.2
communitytoolkit.winui.ui.controls\7.1.2
communitytoolkit.winui.ui.controls.datagrid\7.1.2
microsoft.xaml.behaviors.winui.managed\2.0.9
winuiex\2.3.3

Steps to reproduce the bug

A.)

  1. ) Clone the repo linked at the top of the post
  2. ) Build and run

B.)
1.) Start a WinUI3 template studio project, add other code
3.) Add relevant Nuget packages to ".Core" project
4.) Remove duplicate package references from top level project (it references Core which has Nuget packages)
5.) fix any errors, build and run

  • some errors I encountered in step 4, all have seemingly been resolved through various methods

  • "Found multiple publish output files with the same relative path net8.0-windows10.0.19041.0\MsixContent\Microsoft.Web.WebView2.Core.dll nuget\packages\microsoft.web.webview2\1.0.1264.42\lib\netcoreapp3.0\Microsoft.Web.WebView2.Core.dll. C:\Program Files\dotnet\sdk\8.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ConflictResolution.targets"

  • "Payload contains two or more files with the same destination path 'Microsoft.Web.WebView2.Core.dll"

  • "The specified RuntimeIdentifier 'win10-arm' is not recognized."

  • "The "RemovePayloadDuplicates" task failed unexpectedly. System.ObjectDisposedException: Cannot access a disposed object. Object name: 'it is not allowed to use disposed Microsoft.VisualStudio.Telemetry.TelemetrySession object.'. at Microsoft.VisualStudio.Telemetry.TelemetryDisposableObject.RequiresNotDisposed() at Microsoft.VisualStudio.Telemetry.TelemetrySession.SerializeSettings() at Microsoft.Build.AppxPackage.Telemetry.Get(IBuildEngine4 buildEngine, String vsTelemetrySession) at Microsoft.Build.AppxPackage.AppxPackagingTaskHelper..ctor(IBuildEngine4 buildEngine, TaskLoggingHelper logger, Action execute, Func2 exceptionHandler, Action cleanup, Func1 manifestFileNameGetter, String vsTelemetrySession) at Microsoft.Build.AppxPackage.AppxPackagingTaskBase.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()"

  • Error DEP0700: Registration of the app failed. [0x80073CF6] AppxManifest.xml(29,27): error 0x80070003: Cannot install or update package 86023c1a-67be-4624-99b4-f177b9770392_q3603qz9s7k7e because the splash screen image [SplashScreen.png] cannot be located. Verify that the package contains an image that can be used as a splash screen for the application, and that the package manifest points to the correct location in the package where this splash screen image can be found.

Expected behavior

Running app.

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.4.3: 1.4.231115000

Windows version

Windows 10 (21H2): Build 19044

Additional context

Note that my ACTUAL WINDOWS VERSION IS 10.0.19045 BUILD 19045 however this is not available in the list

@ghost ghost added the bug Something isn't working label Jan 5, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Jan 5, 2024
Copy link

github-actions bot commented Jan 5, 2024

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@DarranRowe
Copy link

How do I attach the solution folder? The file size limit is tiny.

The limit should be around 10MiB. But the easiest way is to use the fact that you have an account on github.

@ghost
Copy link
Author

ghost commented Jan 5, 2024

How do I attach the solution folder? The file size limit is tiny.

The limit should be around 10MiB. But the easiest way is to use the fact that you have an account on github.

Fair, sorry, brain fart, I was in non-open source brain mode :) used to working with support that requires attaching the solution directly such as DevExpress. hopefully that one sentence doesnt deter you from helping me.. i see that everything else was completely ignored

Here is the repo https://github.com/dfmacom/Broken-WinRT-Issue9208

@ghost
Copy link
Author

ghost commented Jan 5, 2024

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

To anyone who stumbles here, my Package.appxmanifest and csproj files in the posted repo have implemented the suggestions in the issue that the bot has linked

@DarranRowe
Copy link

How do I attach the solution folder? The file size limit is tiny.

The limit should be around 10MiB. But the easiest way is to use the fact that you have an account on github.

Fair, sorry, brain fart, I was in non-open source brain mode :) used to working with support that requires attaching the solution directly such as DevExpress. hopefully that one sentence doesnt deter you from helping me.. i see that everything else was completely ignored

Here is the repo https://github.com/dfmacom/Broken-WinRT-Issue9208

It was not completely ignored. I just didn't have any input on it. While I do know some details on the .NET side of things, my expertise is C++. Unless it is a simpler .NET problem or a general WinUI problem, I don't like providing input. But in this case, that didn't stop me from suggesting that you use github to host your example.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working team-Markup Issue for the Markup team
Projects
None yet
Development

No branches or pull requests

2 participants