0

我在 Xamarin Forms 共享项目中使用 parse sdk v2.0。我正在尝试使用来源注册新用户:https ://github.com/parse-community/Parse-SDK-dotNET/#basic-demonstration

服务器解析服务器版本:4.2.0 主机:Back4APP

客户端解析 .NET SDK 版本:-Version 2.0.0-develop-1 Xamarin.Forms Project .NET 2.1

      // Instantiate a ParseClient.
      ParseClient client = new ParseClient(back4app_app_id,"https://parseapi.back4app.com", clientKey);

      var instal = client.Services.GetCurrentInstallation();
      // Create a user, save it, and authenticate with it.
      await client.SignUpAsync(username: "TestABC", password: "Test");    

等待客户端.SignUpAsync(用户名:“TestABC”,密码:“Test”);引发以下异常: System.ArgumentNullException:'值不能为空。参数名称:元素'

堆栈跟踪:

  at System.Attribute.GetCustomAttributes (System.Reflection.Assembly element, System.Type attributeType, System.Boolean inherit) [0x00009] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/attribute.cs:857 
  at System.Attribute.GetCustomAttribute (System.Reflection.Assembly element, System.Type attributeType, System.Boolean inherit) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/attribute.cs:913 
  at System.Attribute.GetCustomAttribute (System.Reflection.Assembly element, System.Type attributeType) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/attribute.cs:906 
  at System.Reflection.CustomAttributeExtensions.GetCustomAttribute (System.Reflection.Assembly element, System.Type attributeType) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/reflection/CustomAttributeExtensions.cs:10 
  at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T] (System.Reflection.Assembly element) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/reflection/CustomAttributeExtensions.cs:27 
  at Parse.Infrastructure.HostManifestData.get_Inferred () [0x0000b] in <12b98f4c44c343d5a566c90715f65c2c>:0 
  at Parse.Infrastructure.ServiceHub+<>c.<get_MetadataController>b__8_0 () [0x00005] in <12b98f4c44c343d5a566c90715f65c2c>:0 
  at Parse.Infrastructure.Utilities.LateInitializer.GetValue[TData] (System.Func`1[TResult] generator) [0x0005b] in <12b98f4c44c343d5a566c90715f65c2c>:0 
  at Parse.Infrastructure.ServiceHub.get_MetadataController () [0x00006] in <12b98f4c44c343d5a566c90715f65c2c>:0 
  at Parse.Infrastructure.ServiceHub.<get_CommandRunner>b__22_0 () [0x0000c] in <12b98f4c44c343d5a566c90715f65c2c>:0 
  at Parse.Infrastructure.Utilities.LateInitializer.GetValue[TData] (System.Func`1[TResult] generator) [0x0005b] in <12b98f4c44c343d5a566c90715f65c2c>:0 
  at Parse.Infrastructure.ServiceHub.get_CommandRunner () [0x00006] in <12b98f4c44c343d5a566c90715f65c2c>:0 
  at Parse.Infrastructure.ServiceHub.<get_UserController>b__36_0 () [0x00000] in <12b98f4c44c343d5a566c90715f65c2c>:0 
  at Parse.Infrastructure.Utilities.LateInitializer.GetValue[TData] (System.Func`1[TResult] generator) [0x0005b] in <12b98f4c44c343d5a566c90715f65c2c>:0 
  at Parse.Infrastructure.ServiceHub.get_UserController () [0x00006] in <12b98f4c44c343d5a566c90715f65c2c>:0 
  at Parse.Abstractions.Infrastructure.CustomServiceHub.get_UserController () [0x00006] in <12b98f4c44c343d5a566c90715f65c2c>:0 
  at Parse.ParseUser+<>c__DisplayClass18_0.<SignUpAsync>b__0 (System.Threading.Tasks.Task _) [0x0000b] in <12b98f4c44c343d5a566c90715f65c2c>:0 
  at Parse.Infrastructure.Utilities.InternalExtensions+<>c__DisplayClass7_0`1[TResult].<OnSuccess>b__0 (System.Threading.Tasks.Task t) [0x0006d] in <12b98f4c44c343d5a566c90715f65c2c>:0 
  at System.Threading.Tasks.ContinuationResultTaskFromTask`1[TResult].InnerInvoke () [0x00024] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskContinuation.cs:108 
  at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319 
--- End of stack trace from previous location where exception was thrown ---

  at Parse.Infrastructure.Utilities.InternalExtensions+<>c__DisplayClass7_0`1[TResult].<OnSuccess>b__0 (System.Threading.Tasks.Task t) [0x00033] in <12b98f4c44c343d5a566c90715f65c2c>:0 
  at System.Threading.Tasks.ContinuationResultTaskFromTask`1[TResult].InnerInvoke () [0x00024] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskContinuation.cs:108 
  at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319 
--- End of stack trace from previous location where exception was thrown ---

我找不到错误。

4

1 回答 1

0

对于任何偶然发现这篇文章的人。该问题有一个解决方法(下面发布的初始化代码)。解决方法在这里描述:https ://github.com/parse-community/Parse-SDK-dotNET/issues/358

var m = new MetadataMutator
{
      EnvironmentData = new EnvironmentData { TimeZone = TimeZoneInfo.Local.StandardName },
      HostManifestData = new HostManifestData { Name = "Test", Identifier = "TestApp", ShortVersion = "1.0.0.0", Version = "1.0.0.0" }
};
ParseClient client = new ParseClient(new ServerConnectionData
{
       ApplicationID = "APP_ID",
       ServerURI = "SERVER_URI",
       Key = "APP_KEY"
},
new LateInitializedMutableServiceHub { MetadataController=m },
m
);
client.Publicize();
于 2021-10-22T22:12:05.553 回答