Valhalla Legends Archive

Programming => General Programming => .NET Platform => Topic started by: K on March 03, 2004, 10:52 PM

Title: System.ExecutionEngineException
Post by: K on March 03, 2004, 10:52 PM
Perhaps someone else could run this code and tell me if it throws an error for them.  I am using the .NET Framework 1.1 and it dies on the marked line with this:

Quote
An unhandled exception of type 'System.ExecutionEngineException' occurred in mscorlib.dll (no additional information)


using System;
using System.Globalization;

namespace Test
{
   class CTest
   {
      [STAThread]
      static void Main(string[] args)
      {
         CultureInfo c = CultureInfo.CurrentCulture;
         RegionInfo r = RegionInfo.CurrentRegion;
         // or
         // RegionInfo r = new RegionInfo(c.LCID);

         // Any reference to any property of r will cause this exception.
         Console.WriteLine(r.Name);
      }
   }
}

Title: Re:System.ExecutionEngineException
Post by: MyndFyre on March 04, 2004, 12:03 PM
I haven't had a chance to test this, as I am at school right now on a PDA.  However, a thought comes to mind...

By default, .NET assemblies are compiled culture-neutral.  Check your AssemblyInfo.cs for an attribute that deals with the current culture.   I believe it is:


[assembly: CurrentCulture(1033)]
// or
[assembly: CurrentCulture("EN-US")]


This will have nothing in its constructor by default.  I don't remember what the constructor parameters can be, but I think both above are valid.  1033 is the code for United States English.  :)

Hope that helps you out.  I'll check it when I get out of class.

Edit: Nope, I was wrong.  It compiles and executes fine, outputting "US\n" to the console.

I was also wrong about the attribute. By default, it has an empty string in its constructor:


[assembly: AssemblyCulture("")]


Sorry K!
Title: Re:System.ExecutionEngineException
Post by: K on March 04, 2004, 09:31 PM
Quote from: Myndfyre on March 04, 2004, 12:03 PM
I haven't had a chance to test this, as I am at school right now on a PDA.  However, a thought comes to mind...

By default, .NET assemblies are compiled culture-neutral.  Check your AssemblyInfo.cs for an attribute that deals with the current culture.   I believe it is:


[assembly: CurrentCulture(1033)]
// or
[assembly: CurrentCulture("EN-US")]


This will have nothing in its constructor by default.  I don't remember what the constructor parameters can be, but I think both above are valid.  1033 is the code for United States English.  :)

Hope that helps you out.  I'll check it when I get out of class.

Edit: Nope, I was wrong.  It compiles and executes fine, outputting "US\n" to the console.

I was also wrong about the attribute. By default, it has an empty string in its constructor:


[assembly: AssemblyCulture("")]


Sorry K!

This is weird.  Maybe I need to reinstall the framework.