question

hexagon99 avatar image
hexagon99 asked

"Cannot find a valid ITransportPlugin type" exception

Hi,

I'm building monogame on visual studio.

My program works great in debug mode. when I'm using release mode, no matter what I try, I get an exception "Cannot find a valid ITransportPlugin type" with this stack trace:

  at PlayFab.PluginManager.CreatePlayFabTransportPlugin () [0x00066] in <4c3d1908f58642ef8a4186bf4e9dd370>:0 
  at PlayFab.PluginManager.GetPluginInternal (PlayFab.PluginContract contract, System.String instanceName) [0x00028] in <4c3d1908f58642ef8a4186bf4e9dd370>:0 
  at PlayFab.PluginManager.GetPlugin[T] (PlayFab.PluginContract contract, System.String instanceName) [0x00000] in <4c3d1908f58642ef8a4186bf4e9dd370>:0 
  at PlayFab.Internal.PlayFabHttp+<DoPost>d__0.MoveNext () [0x00020] in <4c3d1908f58642ef8a4186bf4e9dd370>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <43dbbdc147f2482093d8409abb04c233>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <43dbbdc147f2482093d8409abb04c233>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <43dbbdc147f2482093d8409abb04c233>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <43dbbdc147f2482093d8409abb04c233>:0 
  at PlayFab.PlayFabClientAPI+<LoginWithCustomIDAsync>d__81.MoveNext () [0x000b5] in <4c3d1908f58642ef8a4186bf4e9dd370>:0 


This is happening in android. in UWP it works fine.

This is my code:

var request = new LoginWithCustomIDRequest {
                CustomId = playeruid,
                CreateAccount = true };
            PlayFabResult<LoginResult> loginTask = null;
            var task = Task.Run(async () =>
            {
                var response = PlayFabClientAPI.LoginWithCustomIDAsync(request);
                loginTask = response.Result;


            });
            
                task.Wait();

The exception is on the task.wait().

I tried everything including set the linker to none but no success.

Any ideas?

Thanks!

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
JayZuo avatar image
JayZuo answered

I have a similar issue while using monogame with Android release mode. And here is my error log:

    android.runtime.JavaProxyThrowable: System.MissingMethodException: Default constructor not found for type PlayFab.UUnit.HttpTests+MockTransport
      at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x0007b] in <ac65c5d8fcf649ef83284aaf4dcb9932>:0 
      at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00009] in <ac65c5d8fcf649ef83284aaf4dcb9932>:0 
      at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00027] in <ac65c5d8fcf649ef83284aaf4dcb9932>:0 
      at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00020] in <ac65c5d8fcf649ef83284aaf4dcb9932>:0 
      at System.Activator.CreateInstance (System.Type type) [0x00000] in <ac65c5d8fcf649ef83284aaf4dcb9932>:0 
      at PlayFab.PluginManager.CreatePlayFabTransportPlugin () [0x00045] in <4d2901c9405e400a96981bb3961a37e1>:0 
      at PlayFab.PluginManager.GetPluginInternal (PlayFab.PluginContract contract, System.String instanceName) [0x00028] in <4d2901c9405e400a96981bb3961a37e1>:0 
      at PlayFab.PluginManager.GetPlugin[T] (PlayFab.PluginContract contract, System.String instanceName) [0x00000] in <4d2901c9405e400a96981bb3961a37e1>:0 
      at PlayFab.Internal.PlayFabHttp+<DoPost>d__0.MoveNext () [0x00020] in <4d2901c9405e400a96981bb3961a37e1>:0 
    --- End of stack trace from previous location where exception was thrown ---

It seems to be the same issue as yours. Setting Linker to None Should be able to solve this issue. After changing Linking to None, you may need to delete "bin" and "obj" folder under your project and re-deploy your app to your device to make it work.

Besides, as this error is because "Default constructor not found for type PlayFab.UUnit.HttpTests+MockTransport" and PlayFab.UUnit.HttpTests is used for unit testing, so I just download the latest SDK source: https://github.com/PlayFab/CSharpSDK/releases and delete UUnit related files. And then use the source code in my project and it works well in release mode with Linker set to Sdk Assemblies Only. Hope this can also help you to solve it.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Andy avatar image Andy ♦♦ commented ·

To add some additional clarification, we had a quick chat with the SDK team today. It looks like this problem occurs if you're using Xamarin for Android and our C# SDK. While we'd like to officially support that scenario, we don't right now. Appropriate work items have been created to ensure we track it, but it's not on the schedule yet.

If you can get it to work with JayZuo's suggestions, great! Hopefully it gets easier in the future, though.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.