0

在使用以下参数创建工作项时,我们从 forge 中得到了一个内部错误:

{
  "error":{
    "code":"","message":"An error has occurred.","innererror":{
      "message":"Object reference not set to an instance of an object.","type":"System.NullReferenceException","stacktrace":"   at PublicApi.ResponseExceptionHelper.Throw(HttpStatusCode status, ModelStateDictionary state) in G:\\Repos\\IO\\src\\PublicAPI\\ResponseExceptionHelper.cs:line 31\r\n   at PublicApi.V2.Controllers.WorkItemsV2Controller.CreateEntity(WorkItem2 workItem) in G:\\Repos\\IO\\src\\PublicAPI\\V2\\Controllers\\WorkItemsV2Controller.cs:line 57\r\n   at PublicApi.V2.Controllers.BaseController`1.Post(TEntity entity) in G:\\Repos\\IO\\src\\PublicAPI\\V2\\Controllers\\BaseV2Controller.cs:line 62\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__18`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__18`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Tracing.Tracers.HttpControllerTracer.<ExecuteAsyncCore>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__18`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
    }
  }
}

将以下 JSON 传递给 Forge 会发生这种情况。(部分数值与实际有所不同)

{
  "@odata.type": "#ACES.Models.WorkItem",
  "ActivityId": "CustomActivity",
  "Arguments": {
    "InputArguments": [
      {
        "HttpVerb": "GET",
        "Name": "HostDwg",
        "Resource": "https://s3.amazonaws.com/[path-redacted]",
        "ResourceKind": "ZipPackage",
        "StorageProvider": "Generic"
      },
      {
        "HttpVerb": "GET",
        "Name": "Request",
        "Resource": "https://s3.us-east-2.amazonaws.com/[path-redacted]",
        "ResourceKind": "ZipPackage",
        "StorageProvider": "Generic"
      }
    ],
    "OutputArguments": [
      {
        "HttpVerb": "POST",
        "Name": "GeneratedDrawing.dwg",
        "ResourceKind": "ZipPackage",
        "StorageProvider": "Generic"
      }
    ]
  },
  "Id": "",
  "UserID": "",
  "Version": 1
}

我已经尝试了此代码的任意数量的变体。我已经添加了其他字段并包含了默认值......但是没有任何东西通过这个。

4

1 回答 1

0

我看到的第一个问题是尾随逗号。这不是有效的 json。InputArguments["HostDwg"] 和 OutputArguments["GeneratedDrawing.dwg"] 中的“Generic”之后不应有逗号。

于 2019-03-04T21:10:10.787 回答