Home > Backend Development > C++ > Why are Exception Messages Missing in 64-bit Windows WinForms Applications using VS2010?

Why are Exception Messages Missing in 64-bit Windows WinForms Applications using VS2010?

Susan Sarandon
Release: 2025-02-01 22:06:11
Original
185 people have browsed it

Why are Exception Messages Missing in 64-bit Windows WinForms Applications using VS2010?

VS2010 64 -bit Windows under WinForms Application Missing Outage: In -depth analysis and solution of the problem

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":

  1. Navigation to project & gt; attribute & gt; generate tab. Set the platform target to AnyCPU.

      Cancel "The first choice 32 -bit".
    • This operates the compulsory application as a 64 -bit process, thereby eliminating the problem of WOW64 abnormal suppression.
    • The mandatory debugger is interrupted in an abnormalities:
  2. Turn to debug & gt; abnormal.

    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.
    • Add anomalous treatment to the LOAD event processing process:
  3. Siege the problem code in the LOAD event processing using the TRY-CATCH block.
  4. Use FAILFAST to display an error message in the CATCH block and suddenly terminate the application.

    • Disable wow64 abnormal capture during debugging:
  5. Add to the main () method:
    • This will be disabled abnormal capture disabled in the message cycle during debugging.

      • Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
      Consider avoiding the use of load event processing procedures:
    • Re -evaluate whether your code really needs to be placed in the LOAD event processing program.
    Usually, the initialization task that does not depend on user preferences or window size should be processed in the constructor.
  6. Additional description:

    • In Windows 8 and higher versions, this problem has been resolved. Therefore, updating to a newer operating system may also provide solutions.

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template