question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NotSupportedException on InvokeIfOutputStreamFound

See original GitHub issue

Plugin Version or Commit ID

v0.10.0

Unity Version

2021.3.4f

Your Host OS

Windows 10 Pro / Mac OS

Target Platform

iOS

Description

Suddenly I got this error message when I play the app.

NotSupportedException: To marshal a managed method, please add an attribute named 'MonoPInvokeCallback' to the method definition. The method we're attempting to marshal is: Mediapipe.Unity.OutputStream`2[[Mediapipe.NormalizedLandmarkListPacket, Mediapipe.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null],[Mediapipe.NormalizedLandmarkList, Mediapipe.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]::InvokeIfOutputStreamFound
  at Mediapipe.UnsafeNativeMethods.mp_CalculatorGraph__ObserveOutputStream__PKc_PF_b (System.IntPtr graph, System.String streamName, System.Int32 streamId, Mediapipe.CalculatorGraph+NativePacketCallback packetCallback, System.Boolean observeTimestampBounds, System.IntPtr& status) [0x00000] in <00000000000000000000000000000000>:0 
  at Mediapipe.CalculatorGraph.ObserveOutputStream (System.String streamName, System.Int32 streamId, Mediapipe.CalculatorGraph+NativePacketCallback nativePacketCallback, System.Boolean observeTimestampBounds) [0x00000] in <00000000000000000000000000000000>:0 
  at Mediapipe.Unity.OutputStream`2[TPacket,TValue].AddListener (System.EventHandler`1[TEventArgs] callback) [0x00000] in <00000000000000000000000000000000>:0 
  at Mediapipe.Unity.Holistic.MySolution.OnStartRun () [0x00000] in <00000000000000000000000000000000>:0 
  at Mediapipe.Unity.Holistic.MySolution+<Run>d__26.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0

And this is the definition of InvokeIfOutputStreamFound of OutputStream.cs file (Nothing changed to your code)

  [AOT.MonoPInvokeCallback(typeof(CalculatorGraph.NativePacketCallback))]
    protected static Status.StatusArgs InvokeIfOutputStreamFound(IntPtr graphPtr, int streamId, IntPtr packetPtr)
    {
      try
      {

I can’t get the idea, so could you tell me something suspicious about it?

Code to Reproduce the issue

No response

Additional Context

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Phantomxm2021commented, Aug 25, 2022

I have the same problem. Setting IL2CPP code generation to Faster (smaller) builds makes this issue.

image
NotSupportedException: To marshal a managed method, please add an attribute named 'MonoPInvokeCallback' to the method definition. The method we're attempting to marshal is: Mediapipe.Unity.OutputStream`2[[Mediapipe.NormalizedLandmarkListVectorPacket, Mediapipe.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Collections.Generic.List`1[[Mediapipe.NormalizedLandmarkList, Mediapipe.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]::InvokeIfOutputStreamFound
  at Mediapipe.UnsafeNativeMethods.mp_CalculatorGraph__ObserveOutputStream__PKc_PF_b (System.IntPtr graph, System.String streamName, System.Int32 streamId, Mediapipe.CalculatorGraph+NativePacketCallback packetCallback, System.Boolean observeTimestampBounds, System.IntPtr& status) [0x00000] in <00000000000000000000000000000000>:0 
  at Mediapipe.CalculatorGraph.ObserveOutputStream (System.String streamName, System.Int32 streamId, Mediapipe.CalculatorGraph+NativePacketCallback nativePacketCallback, System.Boolean observeTimestampBounds) [0x00000] in <00000000000000000000000000000000>:0 
  at Mediapipe.Unity.OutputStream`2[TPacket,TValue].AddListener (System.EventHandler`1[TEventArgs] callback) [0x00000] in <00000000000000000000000000000000>:0 
  at HandheldARModule.Runtime.Extension.HandTrackingExtension+<Start>d__25.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0 

Uploading Crash Report
NotSupportedException: To marshal a managed method, please add an attribute named 'MonoPInvokeCallback' to the method definition. The method we're attempting to marshal is: Mediapipe.Unity.OutputStream`2[[Mediapipe.NormalizedLandmarkListVectorPacket, Mediapipe.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Collections.Generic.List`1[[Mediapipe.NormalizedLandmarkList, Mediapipe.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]::InvokeIfOutputStreamFound
  at Mediapipe.UnsafeNativeMethods.mp_CalculatorGraph__ObserveOutputStream__PKc_PF_b (System.IntPtr graph, System.String streamName, System.Int32 streamId, Mediapipe.CalculatorGraph+NativePacketCallback packetCallback, System.Boolean observeTimestampBounds, System.IntPtr& status) [0x00000] in <00000000000000000000000000000000>:0 
  at Mediapipe.CalculatorGraph.ObserveOutputStream (System.String streamName, System.Int32 streamId, Mediapipe.CalculatorGraph+NativePacketCallback nativePacketCallback, System.Boolean observeTimestampBounds) [0x00000] in <00000000000000000000000000000000>:0 
  at Mediapipe.Unity.OutputStream`2[TPacket,TValue].AddListener (System.EventHandler`1[TEventArgs] callback) [0x00000] in <00000000000000000000000000000000>:0 
  at HandheldARModule.Runtime.Extension.HandTrackingExtension+<Start>d__25.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0 
UnityEngine.UnhandledExceptionHandler:PrintException(String, Exception)
UnityEngine.UnhandledExceptionHandler:HandleUnhandledException(Object, UnhandledExceptionEventArgs)
1reaction
homulercommented, Jun 30, 2022

Did you remove the cache (e.g. Library/) before starting UnityEditor?

Read more comments on GitHub >

github_iconTop Results From Across the Web

NotSupportedException Class (System)
NotSupportedException indicates that no implementation exists for an invoked method or property. NotSupportedException uses the HRESULT COR_E_NOTSUPPORTED, ...
Read more >
c# - Read text file return 'System.NotSupportedException' ...
The issue is that there is an invisible character in your string. I don't know how they get there, others have guessed that...
Read more >
NotSupportedException on InvokeIfOutputStreamFound
Suddenly I got this error message when I play the app. NotSupportedException: To marshal a managed method, please add an attribute named 'MonoPInvokeCallback' ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found