When using Visual Studio 2010 to create a new Windows Forms application on the 64 -bit Windows system, it may encounter problems that have not been displayed and unprepared. When the code is not processed in the code in the LOAD event processing program, the program will skip the problem code line and continue to run without any errors. This is different from the behavior of the expected debugger interruption and the unusual display of the unbrocessed information.
The root cause analysis
This abnormal behavior originated from WOW64 (Windows-On-Windows 64-bit) simulation layer to interact with 32-bit code running on 64-bit systems. When the 64 -bit window manager triggers notification, the response code (such as the LOAD event processing program) is executed in a 32 -bit environment. If abnormalities occur in this 32 -bit code, the WOW64 layer may swallow abnormality and prevent the debugger from detecting it.
Solution and change method
Set the platform target as AnyCPU and cancel the selected "Prefer 32 -bit":
Navigation to project & gt; attribute & gt; generate tab. Set the platform target to AnyCPU.
Select CLR abnormal "caused" check box.
This will suspend execution of the mandatory debugger in any CLR abnormal line, regardless of its location in the LOAD event processing program.Use FAILFAST to display an error message in the CATCH block and suddenly terminate the application.
This will be disabled abnormal capture disabled in the message cycle during debugging.
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
Re -evaluate whether your code really needs to be placed in the LOAD event processing program.
Additional description:
The above is the detailed content of Why are Exception Messages Missing in 64-bit Windows WinForms Applications using VS2010?. For more information, please follow other related articles on the PHP Chinese website!