当我想在列表中捕获大量卡片时获取异常

时间:2017-02-19 07:13:45

标签: manatee.trello

@gregdennis我写了这段代码来抓住一个列表中的所有卡片:

var requestList = new List("556be3f8e4a6b530c795db6d");
var cardsCount = requestList.Cards.Filter(CardFilter.All).ToList();

我用URL测试了这个:

https://api.trello.com/1/lists/556be3f8e4a6b530c795db6d/cards?filter=all&key=[myke]&token=[mytoken]

我得到了正确答案但是对于海牛这个例外已经抛出: 调用的目标抛出了异常。 内部例外:预期','。路径:'$ [849] .name' 满堆:

    System.AggregateException was unhandled
  HResult=-2146233088
  Message=One or more errors occurred.
  Source=Manatee.Trello
  StackTrace:
       at Manatee.Trello.Internal.ExceptionHandling.DebugLog.Error(Exception e, Boolean shouldThrow) in C:\Users\gregd\OneDrive\Projects\Manatee.Trello\Manatee.Trello\Internal\ExceptionHandling\DebugLog.cs:line 26
       at Manatee.Trello.Internal.DataAccess.JsonRepository.ValidateResponse(IRestRequest request) in C:\Users\gregd\OneDrive\Projects\Manatee.Trello\Manatee.Trello\Internal\DataAccess\JsonRepository.cs:line 62
       at Manatee.Trello.Internal.DataAccess.JsonRepository.Execute[T](TrelloAuthorization auth, Endpoint endpoint, IDictionary`2 parameters) in C:\Users\gregd\OneDrive\Projects\Manatee.Trello\Manatee.Trello\Internal\DataAccess\JsonRepository.cs:line 28
       at Manatee.Trello.ReadOnlyCardCollection.Update() in C:\Users\gregd\OneDrive\Projects\Manatee.Trello\Manatee.Trello\CardCollection.cs:line 64
       at Manatee.Trello.ReadOnlyCollection`1.GetEnumerator() in C:\Users\gregd\OneDrive\Projects\Manatee.Trello\Manatee.Trello\ReadOnlyCollection.cs:line 58
       at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)
       at OrchidTrello.Program.Main(String[] args) in D:\Projects\Trello API\OrchidTrello\OrchidTrello\Program.cs:line 25
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 
       HResult=-2146232828
       Message=Exception has been thrown by the target of an invocation.
       Source=mscorlib
       StackTrace:
            at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
            at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
            at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
            at Manatee.Trello.WebApi.WebApiJsonFormatter.Deserialize(Type type, String content) in C:\Users\gregd\OneDrive\Projects\Manatee.Trello\Manatee.Trello.WebApi\WebApiJsonFormatter.cs:line 69
            at Manatee.Trello.WebApi.WebApiJsonFormatter.Read(Type type, Stream readStream) in C:\Users\gregd\OneDrive\Projects\Manatee.Trello\Manatee.Trello.WebApi\WebApiJsonFormatter.cs:line 55
            at Manatee.Trello.WebApi.WebApiJsonFormatter.<>c__DisplayClass5_0.<ReadFromStreamAsync>b__0() in C:\Users\gregd\OneDrive\Projects\Manatee.Trello\Manatee.Trello.WebApi\WebApiJsonFormatter.cs:line 42
            at System.Threading.Tasks.Task`1.InnerInvoke()
            at System.Threading.Tasks.Task.Execute()
         --- End of stack trace from previous location where exception was thrown ---
            at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
            at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
            at System.Net.Http.HttpContentExtensions.<ReadAsAsyncCore>d__0`1.MoveNext()
         --- End of stack trace from previous location where exception was thrown ---
            at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
            at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
            at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
            at Manatee.Trello.WebApi.WebApiClient.<ExecuteAsync>d__7`1.MoveNext() in C:\Users\gregd\OneDrive\Projects\Manatee.Trello\Manatee.Trello.WebApi\WebApiClient.cs:line 98
       InnerException: 
            HResult=-2146233088
            Message=Expected ','. Path: '$[944].name'
            Path=$[944].name
            Source=Manatee.Json
            StackTrace:
                 at Manatee.Json.Parsing.JsonParser.Parse(String source) in C:\Users\gregd\OneDrive\Projects\Manatee.Json\Manatee.Json\Parsing\JsonParser.cs:line 51
                 at Manatee.Json.JsonValue.Parse(String source) in C:\Users\gregd\OneDrive\Projects\Manatee.Json\Manatee.Json\JsonValue.cs:line 343
                 at Manatee.Trello.ManateeJson.ManateeSerializer.Deserialize[T](String content) in C:\Users\gregd\OneDrive\Projects\Manatee.Trello\Manatee.Trello.ManateeJson\ManateeSerializer.cs:line 74
            InnerException: 

这是我的版本:

<package id="Manatee.Json" version="5.2.0.1" targetFramework="net452" />
  <package id="Manatee.Trello" version="1.15.0" targetFramework="net452" />
  <package id="Manatee.Trello.ManateeJson" version="1.7.0" targetFramework="net452" />
  <package id="Manatee.Trello.WebApi" version="1.0.6" targetFramework="net452" />

1 个答案:

答案 0 :(得分:0)

Manatee.Json有一个问题。请下载最新版本(v5.2.1或更高版本)以解决此问题。