一段时间以来,我一直在Windows的C#应用程序中使用GoogleSheets API,而没有出现问题。
当我将该程序移植到Linux并使用Mono运行时,它会在“执行”中定期冻结电子表格。获取OR BatchUpdate。
SheetsService service = new SheetsService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = ApplicationName,
});
var gotSS = service.Spreadsheets.Get(spreadsheetId); // <<< freezes HERE
...
var vbur = service.Spreadsheets.Values.BatchUpdate(buvr, spreadsheetId); // <<< OR freezes HERE
它不仅会卡住并且不会返回-应用程序中的所有线程都将冻结。
可能是什么原因?
该线程的堆栈跟踪显示:
“ <未命名线程”位于<0xffffffff>,位于(包装 本地管理)System.Threading.Monitor.Monitor_wait(object,int) [0x00000]在:0处 System.Threading.Monitor.ObjWait(bool,int,object)[0x0002f]在 :0处 System.Threading.Monitor.Wait(object,int,bool)[0x0000e]在 :0处 System.Threading.Monitor.Wait(object,int)[0x00000]在 :0处 System.Threading.ManualResetEventSlim.Wait (int,System.Threading.CancellationToken)[0x00141]在 :0处 System.Threading.Tasks.Task.SpinThenBlockingWait (int,System.Threading.CancellationToken)[0x0002d]在 :0处 System.Threading.Tasks.Task.InternalWait (int,System.Threading.CancellationToken)[0x00069]在 :0处 System.Threading.Tasks.Task
中的[0x0004e]1<TResult_REF>.GetResultCore (bool) [0x00008] in <b78dcefd6c184245be8bf4a1e52466d9>:0 at System.Threading.Tasks.Task
1.get_Result()[0x0000f]在 :0处 Google.Apis.Requests.ClientServiceRequest1<TResponse_REF>.Execute () [0x0000b] in <1587d07172024990b6af5b790c2a559c>:0 at myFuncs.GCMupdates.sendToGoogleSheets (myFuncs.clsPositionManager/HistSummaryData,myFuncs.clsPositionManager/Position2HistData,System.Collections.Generic.Dictionary
2,double,double,double,double,double,System.Collections.Generic.List`1) [0x00236]在<1791c5302f4a454b8cf7412b7f799253>:0中 myFuncs.GCMupdates.sendNotification (myFuncs.clsPositionManager / HistSummaryData,double,myFuncs.clsPositionManager / Position2HistData,myFuncs.subLog) [0x009c3]在<1791c5302f4a454b8cf7412b7f799253>:0中 Master.MainForm.UpdateDets (myFuncs.clsPositionManager / HistSummaryData,int,int,double,myFuncs.clsPositionManager / Position2HistData,myFuncs.subLog) [0x0063e]在<4860a2c0b9a848eeab8026906aeac5a8>:0中((包装 运行时调用) .runtime_invoke_void__this ___ object_int_int_double_object_object (object,intptr,intptr,intptr)[0x0006b]在 在<0xffffffff>处<4860a2c0b9a848eeab8026906aeac5a8>:0 (包装器管理为本地) System.Reflection.MonoMethod.InternalInvoke (System.Reflection.MonoMethod,object,object [],System.Exception&) [0x0000c] in:0 at System.Reflection.MonoMethod.Invoke (对象,System.Reflection.BindingFlags,System.Reflection.Binder,对象[],System.Globalization.CultureInfo) [0x0003b]在:0处 System.Reflection.MethodBase.Invoke(object,object [])[0x00000] in :0处 System.Delegate.DynamicInvokeImpl(object [])[0x000e7]在 :0处 System.MulticastDelegate.DynamicInvokeImpl(object [])[0x00008]在 :0处 System.Delegate.DynamicInvoke(object [])[0x00000]在 :0处 System.Windows.Forms.XplatUIDriverSupport.ExecutionCallback (System.Windows.Forms.AsyncMethodData)[0x00007]在 <951cc200450d41168b6f8c8543d9b41e>:0在 System.Windows.Forms.XplatUIDriverSupport.ExecutionCallbackInContext (对象)在<951cc200450d41168b6f8c8543d9b41e>:0中的[0x00027] System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,对象,布尔) [0x00071]在:0处 System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,对象,布尔) [0x00000]在:0处 System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,对象) [0x0002b]在:0处 System.Windows.Forms.XplatUIDriverSupport.ExecuteClientMessage (System.Runtime.InteropServices.GCHandle)[0x00028]在 <951cc200450d41168b6f8c8543d9b41e>:0在 System.Windows.Forms.XplatUIX11.GetMessage (object,System.Windows.Forms.MSG&,intptr,int,int)[0x01762]在 <951cc200450d41168b6f8c8543d9b41e>:0在 System.Windows.Forms.XplatUI.GetMessage (object,System.Windows.Forms.MSG&,intptr,int,int)[0x00000]在 <951cc200450d41168b6f8c8543d9b41e>:0在 System.Windows.Forms.Application.RunLoop (bool,System.Windows.Forms.ApplicationContext)[0x0034e]在 <951cc200450d41168b6f8c8543d9b41e>:0在 System.Windows.Forms.Application.Run (System.Windows.Forms.ApplicationContext)[0x00011]在 <951cc200450d41168b6f8c8543d9b41e>:0在 System.Windows.Forms.Application.Run(System.Windows.Forms.Form) [0x00006]在<951cc200450d41168b6f8c8543d9b41e>:0中 Master.Program.Main(string [])[0x00137]在 <4860a2c0b9a848eeab8026906aeac5a8>:0 at(包装运行时调用) .runtime_invoke_void_object(object,intptr,intptr,intptr) <4860a2c0b9a848eeab8026906aeac5a8>:0