- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我一直在想这个问题。在我们的一台客户端(Windows 7、.NET 2.0)机器上,以下代码似乎失败了(导致应用程序关闭),但似乎没有抛出任何异常。
在日志中打印了“发送休息请求”,然后什么也没有。我的期望是将打印以下日志消息之一(异常之一或信息消息之一)。
查看事件日志显示 Windows 错误报告服务大约在此时启动然后停止,但没有创建转储文件。
如能深入了解可能发生的情况或如何获取更多信息进行调试,我们将不胜感激。谢谢
try
{
System.Net.ServicePointManager.Expect100Continue = false;
System.Net.ServicePointManager.UseNagleAlgorithm = false;
HttpWebRequest webRequest = ProxiedHttpWebRequest.CreateWithProxy(web_uri);
webRequest.Method = request_method;
if (content_type != null)
{
webRequest.ContentType = content_type;
}
webRequest.Method = request_method;
if (data != null)
{
webRequest.ContentLength = data.Length; //Count bytes to send
}
else
{
webRequest.ContentLength = 0;
}
webRequest.KeepAlive = true;
if (webRequest.Method == "POST")
{
//write post data
using (Stream os = webRequest.GetRequestStream())
{
os.Write(data, 0, data.Length);
}
}
if (headers != null)
{
foreach (KeyValuePair<string, string> pair in headers)
{
webRequest.Headers.Add(pair.Key, pair.Value);
}
}
Logger.Info("Sending rest request");
using (HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse())
{
if (webResponse != null)
{
Logger.Info("received response");
ResponseCode = webResponse.StatusCode;
using (StreamReader sr = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8))
{
string response = sr.ReadToEnd().Trim();
return response;
}
}
else
{
Logger.Info("a null response was received from the web");
}
}
return null;
}
catch (WebException we)
{
Logger.Warn(TraceLogger.GenerateErrorStringFromException(we));
throw we;
}
catch (Exception e)
{
Logger.Warn(TraceLogger.GenerateErrorStringFromException(e));
throw e;
}
编辑:我应该补充说这是一个暂时性错误(它每隔几天就会失败一次,而且只在这台机器上)。代码在 200 多台机器上运行
EDIT2:我还使用以下代码启动代码以捕获未处理的异常:
// Add the event handler for handling non-UI thread exceptions to the event.
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
// Add the event handler for handling UI thread exceptions to the event.
Application.ThreadException += Application_ThreadException;
// Set the unhandled exception mode to force all Windows Forms errors to go through
// our handler.
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
EDIT3:记录。日志记录代码绝对有可能是崩溃的原因。我正在使用非常稳定的 apache 中的 Log4Net 和默认在每次日志请求后刷新的 RollingFileAppender。当日志级别使得警告不会被记录时,也会发生错误。
EDIT4:运行 procdump 后,我能够在程序崩溃时捕获该程序的转储。在 Windbg 中打开它并运行 !analyze -v
FAULTING_IP:
+ae31be0
00000000`00000000 ?? ???
EXCEPTION_RECORD: ffffffffffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress: 0000000000000000
ExceptionCode: 80000003 (Break instruction exception)
ExceptionFlags: 00000000
NumberParameters: 0
FAULTING_THREAD: 0000000000001404
PROCESS_NAME: app_2_0_0_122.exe
ERROR_CODE: (NTSTATUS) 0x80000003 - {EXCEPTION} Breakpoint A breakpoint has been reached.
EXCEPTION_CODE: (HRESULT) 0x80000003 (2147483651) - One or more arguments are invalid
MOD_LIST: <ANALYSIS/>
NTGLOBALFLAG: 0
APPLICATION_VERIFIER_FLAGS: 0
MANAGED_STACK: !dumpstack -EE
No export dumpstack found
ADDITIONAL_DEBUG_TEXT: Followup set based on attribute [Is_ChosenCrashFollowupThread] from Frame:[0] on thread:[PSEUDO_THREAD]
LAST_CONTROL_TRANSFER: from 000007fef6ebce72 to 0000000076c0933a
DEFAULT_BUCKET_ID: STACKIMMUNE
PRIMARY_PROBLEM_CLASS: STACKIMMUNE
BUGCHECK_STR: APPLICATION_FAULT_STACKIMMUNE_NOSOS_WRONG_SYMBOLS
STACK_TEXT:
00000000`00000000 00000000`00000000 app_2_0_0+0x0
SYMBOL_NAME: app_2_0_0
FOLLOWUP_NAME: MachineOwner
MODULE_NAME: app_2_0_0
IMAGE_NAME: app_2_0_0
DEBUG_FLR_IMAGE_TIMESTAMP: 0
STACK_COMMAND: ** Pseudo Context ** ; kb
FAILURE_BUCKET_ID: STACKIMMUNE_80000003_app_2_0_0!Unloaded
BUCKET_ID: X64_APPLICATION_FAULT_STACKIMMUNE_NOSOS_WRONG_SYMBOLS_app_2_0_0
编辑:- WindDbg 的输出
0:000> !threads
- .. 输出已删除并更正下面的输出
<罢工>0:000> !pe 未找到导出 pe .. 下面是正确的输出
<罢工>0:000> !EEStack -EE 未找到导出 EEStack - 下面是正确的输出
加载 sos 和 clr 并运行 !analyze -v
后,WindDbg 还产生了以下堆栈
STACK_TEXT:
00000000`0024e6d8 000007fe`f6ebce72 : 00000000`0024f000 00000000`0024e5d1 00000000`00000000 00000000`00000000 : user32!ZwUserWaitMessage+0xa
00000000`0024e6e0 000007fe`f0a1ec14 : 00000000`027f3260 00000000`0024e7c0 000007fe`f095f548 00000000`00000001 : mscorwks!DoNDirectCallWorker+0x62
00000000`0024e770 000007fe`f0a1e278 : 00000000`02857a00 00000000`00000001 00000000`ffffffff 00000000`00000000 : System_Windows_Forms_ni+0x35ec14
00000000`0024e9c0 000007fe`f0a1dce5 : 00000000`027f3260 00000000`ffffffff 00000000`02857998 000007fe`f104cd48 : System_Windows_Forms_ni+0x35e278
00000000`0024eb10 000007ff`001804a5 : 00000000`00000000 00000000`00000000 00000000`0024e888 00000000`0000000c : System_Windows_Forms_ni+0x35dce5
00000000`0024eb70 000007fe`f6ebd432 : 00000000`027f3668 00000000`00000000 000007ff`00033fa8 000007fe`f6d62fa9 : 0x7ff`001804a5
00000000`0024ebf0 000007fe`f6dab7a3 : 00000000`00000002 00000000`00000027 000007fe`f6c77340 00000000`00000000 : mscorwks!CallDescrWorker+0x82
00000000`0024ec40 000007fe`f729a981 : 00000000`0024ed78 00000000`00000000 00000000`0024ef80 00000000`00000008 : mscorwks!CallDescrWorkerWithHandler+0xd3
00000000`0024ece0 000007fe`f6e086db : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`0024f1e0 : mscorwks!MethodDesc::CallDescr+0x2b1
00000000`0024ef20 000007fe`f6e2bd54 : 00000000`00000000 00000000`00000000 0000000d`00d6000a 00000000`00000000 : mscorwks!ClassLoader::RunMain+0x22b
00000000`0024f180 000007fe`f7386c9d : 00000000`0024f7d0 00000000`00000000 00000000`0076bbc8 00000000`00000200 : mscorwks!Assembly::ExecuteMainMethod+0xbc
00000000`0024f470 000007fe`f6e3929f : 00000000`00000000 00000000`00000000 00000000`00000000 000007fe`f6e55c12 : mscorwks!SystemDomain::ExecuteMainMethod+0x47d
00000000`0024fa40 000007fe`f6e1bfdc : ffffffff`fffffffe 00000000`00000000 00009fee`00000000 00000000`00000000 : mscorwks!ExecuteEXE+0x47
00000000`0024fa90 000007fe`f7923309 : ffffffff`ffffffff 00000000`0075dbd0 00000000`00000000 00000000`0024fa98 : mscorwks!CorExeMain+0xac
00000000`0024faf0 000007fe`f7a15b21 : 000007fe`f6e1bf30 000007fe`f79232c0 00000000`00000000 00000000`00000000 : mscoreei!CorExeMain+0x41
00000000`0024fb20 00000000`7677652d : 000007fe`f7920000 00000000`00000000 00000000`00000000 00000000`00000000 : mscoree!CorExeMain_Exported+0x57
00000000`0024fb50 00000000`76e6c541 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : kernel32!BaseThreadInitThunk+0xd
00000000`0024fb80 00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x1d
编辑:下面 !pe
的结果。有趣的是,它试图加载的 dll 存在。它是服务和应用程序组件使用的实用程序 dll 的自动生成序列化。
0:000> !pe
Exception object: 0000000002831e48
Exception type: System.BadImageFormatException
Message: Could not load file or assembly 'Utilities_2_0_0_122.XmlSerializers, Version=2.0.0.122, Culture=neutral, PublicKeyToken=0bd8b79f92cc7463' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
InnerException: System.BadImageFormatException, use !PrintException 00000000028325c0 to see more
StackTrace (generated):
SP IP Function
000000000024E740 0000000000000001 System.Reflection.Assembly._nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.Assembly, System.Threading.StackCrawlMark ByRef, Boolean, Boolean)
000000000024E740 000007FEF5DEBF61 System.Reflection.Assembly.InternalLoad(System.Reflection.AssemblyName, System.Security.Policy.Evidence, System.Threading.StackCrawlMark ByRef, Boolean)
000000000024E7D0 000007FEF5E249E4 System.Reflection.Assembly.Load(System.Reflection.AssemblyName)
000000000024E810 000007FEF42A5C0A System.Xml.Serialization.TempAssembly.LoadGeneratedAssembly(System.Type, System.String, System.Xml.Serialization.XmlSerializerImplementation ByRef)
StackTraceString: <none>
HResult: 8013101b
0:000> !PrintException 00000000028325c0
Exception object: 00000000028325c0
Exception type: System.BadImageFormatException
Message: Could not load file or assembly 'Utilities_2_0_0_122.XmlSerializers, Version=2.0.0.122, Culture=neutral, PublicKeyToken=0bd8b79f92cc7463' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
InnerException: <none>
StackTrace (generated):
<none>
StackTraceString: <none>
HResult: 8013101b
编辑:根据要求提供 GenerateErrorStringFromException 的来源
public static string GenerateErrorStringFromException(Exception e)
{
try
{
string s = "";
s += "Outer Exception." + "\n";
s += "ExceptionType: " + e.GetType().Name + "\n";
s += "Message: " + e.Message + "\n";
s += "Source: " + e.Source + "\n";
s += "StackTrace: " + e.StackTrace + "\n";
s += "TargetSite: " + e.TargetSite + "\n";
string indent = "\t";
Exception ie = e;
while (ie.InnerException != null)
{
ie = ie.InnerException;
s += "Inner Exception." + "\n";
s += indent + "ExceptionType: " +
ie.GetType().Name + "\n";
s += indent + "Message: " + ie.Message + "\n";
s += indent + "Source: " + ie.Source + "\n";
s += indent + "StackTrace: " + ie.StackTrace + "\n";
s += indent + "TargetSite: " + ie.TargetSite + "\n";
indent += "\t";
}
return s;
}
catch (Exception)
{
return
"Fatal problem, an error was generated while printing an exception - no message given on orginal issue ";
}
}
编辑:应该早点包含这个。客户端机器是 x64,目标构建是 Any_CPU。客户端安装了 .NET 4.5,目标平台是 .NET 2.0。
编辑:!threads
和 !EEStack -EE
的输出
0:000> !threads
ThreadCount: 8
UnstartedThread: 0
BackgroundThread: 6
PendingThread: 0
DeadThread: 1
Hosted Runtime: no
PreEmptive Lock
ID OSID ThreadOBJ State GC GC Alloc Context Domain Count APT Exception
0 1 1404 000000000075dbd0 6020 Enabled 0000000000000000:0000000000000000 0000000000754c60 0 Ukn System.BadImageFormatException (0000000002831e48)
2 2 1540 0000000000763bd0 b220 Enabled 0000000000000000:0000000000000000 0000000000754c60 0 Ukn (Finalizer)
5 3 1ac0 000000001aedff20 880b220 Enabled 0000000002b11a50:0000000002b135c0 0000000000754c60 0 Ukn (Threadpool Completion Port)
6 4 1530 000000001aee0da0 80a220 Enabled 0000000000000000:0000000000000000 0000000000754c60 0 Ukn (Threadpool Completion Port)
8 6 41c 000000001c5d4960 180b220 Enabled 0000000000000000:0000000000000000 0000000000754c60 0 Ukn (Threadpool Worker) System.ArgumentException (0000000002a676d8)
10 5 dfc 000000001ba94600 180b220 Enabled 0000000002b19680:0000000002b1b5c0 0000000000754c60 2 Ukn (Threadpool Worker) System.ArgumentException (0000000002add658)
14 8 1e6c 000000001c9c2bf0 200b220 Enabled 0000000000000000:0000000000000000 0000000000754c60 1 Ukn
XXXX 7 0 000000001c9b69a0 9820 Enabled 0000000000000000:0000000000000000 0000000000754c60 0 Ukn
0:000> !EEEStack -EE
No export EEEStack found
0:000> !EEStack -EE
---------------------------------------------
Thread 0
Unable to load image C:\Windows\assembly\NativeImages_v2.0.50727_64\System.Windows.Forms\95674cb72317e3a5380ea450b913786f\System.Windows.Forms.ni.dll, Win32 error 0n2
*** WARNING: Unable to verify checksum for System.Windows.Forms.ni.dll
Child-SP RetAddr Call Site
000000000024e770 000007fef0a1e278 System_Windows_Forms_ni!System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32, Int32, Int32)+0x7d4
000000000024e9c0 000007fef0a1dce5 System_Windows_Forms_ni!System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)+0x578
000000000024eb10 000007ff001804a5 System_Windows_Forms_ni!System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)+0x65
000000000024eb70 000007fef6ebd432 app_2_0_0_122!app_2_0_0_122.exe!Unknown+0x245
---------------------------------------------
Thread 2
Child-SP RetAddr Call Site
---------------------------------------------
Thread 5
Child-SP RetAddr Call Site
---------------------------------------------
Thread 6
Child-SP RetAddr Call Site
---------------------------------------------
Thread 8
Child-SP RetAddr Call Site
---------------------------------------------
Thread 10
*** WARNING: Unable to verify checksum for mscorlib.ni.dll
Child-SP RetAddr Call Site
000000001d82e220 000007fef0a1e278 System_Windows_Forms_ni!System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32, Int32, Int32)+0x7d4
000000001d82e470 000007fef0a1dce5 System_Windows_Forms_ni!System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)+0x578
000000001d82e5c0 000007fef109f253 System_Windows_Forms_ni!System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)+0x65
000000001d82e620 000007ff001ac37d System_Windows_Forms_ni!System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window)+0x763
000000001d82e910 000007ff001abce4 app_2_0_0_122!app_2_0_0_122.exe!Unknown+0x4dd
000000001d82ea00 000007ff001ab803 app_2_0_0_122!app_2_0_0_122.exe!Unknown+0x34
000000001d82ea50 000007ff001aaf9c app_2_0_0_122!app_2_0_0_122.exe!Unknown+0x113
000000001d82ead0 000007ff001a8706 app_2_0_0_122!app_2_0_0_122.exe!Unknown+0x23c
000000001d82eb70 000007ff001a85f8 app_2_0_0_122!app_2_0_0_122.exe!Unknown+0x96
000000001d82ebf0 000007fef5dedd38 Utilities_2_0_0_122!Utilities_2_0_0_122.dll!Unknown+0x58
000000001d82ec40 000007fef6ebd432 mscorlib_ni!System.Threading.ExecutionContext.runTryCode(System.Object)+0x178
000000001d82f4e0 000007fef5e2edd6 mscorlib_ni!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)+0x62
000000001d82f530 000007fef6ebd432 mscorlib_ni!System.Threading._TimerCallback.PerformTimerCallback(System.Object)+0x86
---------------------------------------------
Thread 14
Unable to load image C:\Windows\assembly\NativeImages_v2.0.50727_64\System\af0a0b96a02f9925eb84392ee65a5cfa\System.ni.dll, Win32 error 0n2
*** WARNING: Unable to verify checksum for System.ni.dll
Child-SP RetAddr Call Site
000000002202f090 000007fef5104487 mscorlib_ni!System.Threading.WaitHandle.WaitAny(System.Threading.WaitHandle[], Int32, Boolean)+0x64
000000002202f0f0 000007fef5dd2bbb System_ni!System.Net.TimerThread.ThreadProc()+0x327
000000002202f1c0 000007fef5e6aadd mscorlib_ni!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)+0x9b
000000002202f210 000007fef6ebd432 mscorlib_ni!System.Threading.ThreadHelper.ThreadStart()+0x4d
编辑:procdump 参数 procdump.exe -h -e -t app_2_0_0_122.exe C:\Temp\Dump.dump
它也值得包括 WinDbg 输出的第一行,我假设它是转储的触发器 *** Hung window detected: 180a5c
最佳答案
这一行很奇怪:
ERROR_CODE: (NTSTATUS) 0x80000003 - {EXCEPTION} Breakpoint A breakpoint has been reached.
您的记录器代码中有一些 Debugger.Break
或一些 Debug.Assert
吗?
关于c# - HttpWebResponse.GetResponseStream() (似乎)毫无异常(exception)地失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18128598/
我在使用以下代码时遇到问题: function http_file_exists($url){ $f=fopen($url,"r"); if($f){ fclose($f); retu
我已经通过 Git 部署到 Azure 几个月了,没有出现重大问题,但现在我似乎遇到了一个无法克服的错误。 我创建了一个新的 Azure 网站,为正在开发的项目创建单独的预览链接。我在新站点上设置了
我已经通过flutter创建了一个App并完成了它,我想在flutter文档中阅读时进行部署。 我收到此错误: FAILURE: Build failed with an exception. * W
我在Windows 10中使用一些简单的Powershell代码遇到了这个奇怪的问题,我认为这可能是我做错了,但我不是Powershell的天才。 我有这个: $ix = [System.Net.Dn
我正在尝试使用 RapidJSON 解析从服务器接收到的数据。以下是收到的确切字符串: [ { "Node": "9478149a08f9", "Address": "172.17
我尝试为 ios 编译 OpenCV。我总是收到这些错误。我用不同版本的opencv试了一下,结果都是一样的。 我运行这个:python 平台/ios/build_framework.py ios_o
我在一台机器上做基本的发布/订阅,我的客户端是 StackExchange-Redis 的 C# 客户端,我在同一台机器上运行基于 Windows 的 Redis 服务器(服务器版本 2.8.4) 当
我有这段代码,但无法执行,请帮我解决这个问题 连接 connect_error) { die ("connection failed: " . $terhubung->connect_erro
我在 tomcat 上运行并由 maven 编译的 Web 应用程序给出了以下警告和错误。我可以在本地存储库中看到所有 JAR,但有人可以帮忙吗。 WARNING: Failed to scan JA
我正在 Windows 8 上使用 Android Studio 开发一个 android 应用程序,我正在使用一些 native 代码。突然间我无法编译我的 C 文件。当我运行 ndk-build
下面的代码对类和结构的成员进行序列化和反序列化。序列化工作正常,但我在尝试使用 oarch >> BOOST_SERIALIZATION_NVP(outObj); 反序列化时遇到了以下错误; 代码中是
如果我运行此命令“rspec ./spec/requests/api/v1/password_reset_request_spec.rb”,此文件中的所有测试都会通过。 但是,当我运行“rspec”时
我在尝试执行测试以使用 Protractor 上传文件时出错,我的代码是这个 it('it should be possible to upload a file', function() {
System.loadLibrary("nativefaceswap"); 当我运行我的应用程序时,我在 Android Studio 中发现了此类错误。在logcat中显示: java.lang.U
我希望有人能帮助我!使用任何方法或命令行的任何 SSL/HTTPS 调用均无效。 我在 Windows 10 中使用 Ubuntu Server 18.04 作为子系统。我的问题是昨天才开始出现的,因
通过删除这两个值将日期字段从 null=True 和 Blank=True 更改为 required 时,使用 db.alter 命令时遇到问题。 当以下行被注释掉时,迁移运行不会出现问题。
我第一次使用 Heroku 尝试创建应用程序(使用 SendGrid 的 Inbound Parse Webhook"和 Twilio SMS 通过电子邮件发送和接收 SMS 消息)。通过 Virtu
我正在将我的 swift 项目更新到 Xcode 7 上的 Swift 2.0。xcode 在构建项目时报告了以下错误: 命令/Applications/Xcode.app/Contents/Deve
在我的代码中,SSL 库函数 SSL_library_init() 没有按预期返回 1。我如何才能看到它返回了什么错误? 我在 SSL_library_init() 之后调用了 SSL_load_er
我正在尝试运行在以下链接中找到的答案: Asynchronously Load the Contents of a Div 但是当我这样做时,我会遇到我不太理解的错误。 我的代码: $(documen
我是一名优秀的程序员,十分优秀!