【发布时间】:2014-10-21 15:09:31
【问题描述】:
我认为我在 NuGet Dll 地狱中。
我的第一个问题发生在:
无法加载文件或程序集“System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f711d50a3a”或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。
但我可以在 web.config/app.config 中放置正确的dependentAssembly 来解决它。
现在,我有一个新错误,我不知道如何解决它
ThreadAbortExceptionSubproceso anulado。 - 数据:System.Collections.ListDictionaryInternal - 堆栈跟踪:en Google.Apis.Requests.ClientServiceRequest
1.Execute() en c:\code\google.com\google-api-dotnet-client\default\Tools\Google.Apis.Release\bin\Debug\test\default\Src\GoogleApis\Apis\Requests\ClientServiceRequest.cs:línea 100 en AppLayer.Control.Engines.Database.Bigquery.InsertAll(BigqueryService s, String datasetId, String tableId, List1 数据)en d:\Programació\Nostrum\BACKEND\AppLayer\Control\Engines\Database\Bigquery.cs:línea 175 - 来源:Google.Apis - InnerException:Subproceso anulado。 Google.Apis 21/10/2014 17:04:10 ThreadAbortExceptionSubproceso anulado.System.Collections.ListDictionaryInternal System.Collections.Generic.List`1[Google.Apis.Bigquery.v2.Data.TableDataInsertAllRequest+RowsData]
我正在使用 Visual Studio 2012 Update 4,这是我的代码
public bool InsertAll(BigqueryService s, String datasetId, String tableId, List<TableDataInsertAllRequest.RowsData> data)
{
try
{
TabledataResource t = s.Tabledata;
TableDataInsertAllRequest req = new TableDataInsertAllRequest()
{
Kind = "bigquery#tableDataInsertAllRequest",
Rows = data
};
//My code crashes in the next line
TableDataInsertAllResponse response = t.InsertAll(req, projectId, datasetId, tableId).Execute();
if (response.InsertErrors != null)
{
return true;
}
}
catch (ThreadAbortException e)
{
throw e;
}
catch (Exception e)
{
throw e;
}
return false;
}
有人知道如何解决这个问题吗?我很沮丧...
如果我删除了 catch 块,我会在输出窗口中得到它
'vstest.executionengine.x86.exe'(托管 (v4.0.30319)):已加载 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\mscorlib.resources\v4.0_4.0.0.0_es_b77a5c561934e089\mscorlib。资源.dll' 'vstest.executionengine.x86.exe'(托管(v4.0.30319)):加载'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Threading.Tasks\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Threading .Tasks.dll' 'vstest.executionengine.x86.exe'(托管(v4.0.30319)):加载'D:\Programació\Nostrum\BACKEND\TestSubmitService\bin\Debug\Microsoft.Threading.Tasks.dll' 在 mscorlib.dll 中发生了“System.Threading.ThreadAbortException”类型的第一次机会异常 Google.Apis.dll 中出现了“System.Threading.ThreadAbortException”类型的第一次机会异常 Google.Apis.dll 中出现了“System.Threading.ThreadAbortException”类型的第一次机会异常 'vstest.executionengine.x86.exe'(托管 (v4.0.30319)):加载了 'C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\es\Microsoft.VisualStudio。 TestPlatform.TestExecutor.Core.resources.dll' 'vstest.executionengine.x86.exe'(托管 (v4.0.30319)):加载 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Transactions.resources\v4.0_4.0.0.0_es_b77a5c561934e089\System.Transactions .resources.dll' System.Transactions 严重:0:http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/UnhandledExcepción no controladavstest.executionengine.x86.exeSystem.AppDomainUnloadedException,mscorlib,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089Intento de obtener acceso a un AppDomain descargado。 System.AppDomainUnloadedException: Intento de obtener acceso a un AppDomain descargado。 Google.Apis.dll 中出现“System.Threading.ThreadAbortException”类型的异常,但未在用户代码中处理 步入:跨过非用户代码“System.Threading.ExecutionContext.RunInternal” 线程 '' (0x77c) 以代码 0 (0x0) 退出。 线程 '' (0xd44) 以代码 0 (0x0) 退出。 'vstest.executionengine.x86.exe'(托管(v4.0.30319)):加载'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xaml\v4.0_4.0.0.0__b77a5c561934e089\System.Xaml.dll ', 跳过加载符号。模块已优化,调试器选项“仅我的代码”已启用。 'vstest.executionengine.x86.exe'(托管(v4.0.30319)):加载'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.resources\v4.0_4.0.0.0_es_b77a5c561934e089\System.ServiceModel .resources.dll' 'vstest.executionengine.x86.exe'(托管(v4.0.30319)):加载'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.resources\v4.0_4.0.0.0_es_b77a5c561934e089\System.resources.dll ' 程序“[4552] vstest.executionengine.x86.exe:程序跟踪”已退出,代码为 0 (0x0)。 程序“[4552] vstest.executionengine.x86.exe: Managed (v4.0.30319)”已退出,代码为 0 (0x0)。
【问题讨论】:
-
摆脱你的
catch块;他们破坏堆栈跟踪。 -
我已经用错误跟踪更新了我的帖子,该错误跟踪在没有 catch 块的情况下运行程序
-
A
ThreadAbortException表示代码试图中止正在运行的线程。你有任何中止线程的代码吗? 可能 Google API 本身会在超时的情况下中止线程,但这不太可能。您是否在单元测试中运行代码? -
是的@Panagiotis Kanavos,我在单元测试中运行代码
标签: c# nuget-package google-api-dotnet-client