Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8208771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:29:24+00:00 2026-06-07T09:29:24+00:00

i just had a problem while debugging which i don’t get: I’m using a

  • 0

i just had a problem while debugging which i don’t get:
I’m using a method from kernel32.dll to get the Free RAM, however it throws an System.EngineExecutionException, which I catch, but the Debugger stops anyway at the exception and refuses to continue.
So why is the Exception not catched?

using System;
using System.Collections.Generic;
using System.Text;
using System.Management;
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace StationController.Diagnose
{
public class Memorystatus
{
    public UInt32 Length;
    public UInt32 MemoryLoad;
    public UInt32 TotalPhys;
    public UInt32 AvailPhys;
    public UInt32 TotalPageFile;
    public UInt32 AvailPageFile;
    public UInt32 TotalVirtual;
    public UInt32 AvailVirtual;
}
class Test
{
    [DllImport("kernel32")]
    private static extern void GlobalMemoryStatus(ref Memorystatus buf);

    private static UInt32 GetFreeRAM()
    {
        try
        {
            Memorystatus MemStat=new Memorystatus();
            GlobalMemoryStatus(ref MemStat);
        }
        catch (System.ExecutionEngineException){ return 0; }
        catch (System.Exception) { return 0; }
        catch { return 0; } //I know kind of redundant
        return sMemStat.AvailPhys;
    }
}
}

Tools->Options->”Stop when Exception is outside AppDomain” is unchecked

I already fixed the reason for the exception, Memorystatus has to be a struct not a class, this question is about the try-catch behaviour

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T09:29:25+00:00Added an answer on June 7, 2026 at 9:29 am

    A System.EngineExecutionException is an internal .NET error which as far as I know is thrown by the CLR when something goes horribly wrong.

    Is it catchable? I don’t think so – as I think an exception at this level prevents your code from continuing to execute

    http://social.msdn.microsoft.com/Forums/eu/clr/thread/4425321d-b291-4a2a-899c-8266f16e26d8

    It’s probably due to messing with unmanaged memory – e.g. your kernel32.dll call

    http://msdn.microsoft.com/en-us/library/system.executionengineexception.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a weird problem. i fetch some rows from database using: while($tag =
just had a general question about how to approach a certain problem I'm facing.
Seems like just yesterday I had this same problem with Play! v1. After trying
Just wondering if you had any thoughts on this problem. I want to make
Here's a problem I've had recently that just HAS to be a common pain
Just had a discussion at work about the merits of using PostgreSQL over MySQL
I've had this problem for a while now but I have to remedy it
I have had this problem for a while, still trying to work on a
First, I had a problem with getting the data from the Database, it took
So I've run into a problem while integrating QT and OSG. I've had a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.