Context: Azure, C#, ClearScript.V8.5.4.5
I have a number of C# programs running under the scheduler in an Azure VM. All but two are currently working due to an error which identifies itself by a last run result of 0xE0434352.
In Event Viewer -> Windows Logs -> Application there are a number of errors listed, all of which say mostly the same as the following
```
Application: NormanEmailHandler.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.ComponentModel.Win32Exception at MS.Win32.UnsafeNativeMethods.RegisterClassEx(WNDCLASSEX_D) at MS.Win32.HwndWrapper..ctor(Int32, Int32, Int32, Int32, Int32, Int32, Int32, System.String, IntPtr, MS.Win32.HwndWrapperHook[]) at System.Windows.Threading.Dispatcher..ctor() at System.Windows.Threading.Dispatcher.get_CurrentDispatcher() at Microsoft.ClearScript.Windows.WindowsScriptEngine..ctor(System.String, System.String, Microsoft.ClearScript.Windows.WindowsScriptEngineFlags) at Microsoft.ClearScript.Windows.JScriptEngine..ctor(System.String, System.String, Microsoft.ClearScript.Windows.WindowsScriptEngineFlags) at Microsoft.ClearScript.Windows.JScriptEngine..ctor(Microsoft.ClearScript.Windows.WindowsScriptEngineFlags) at NormanEmailHandler.Program..cctor() Exception Info: System.TypeInitializationException at NormanEmailHandler.Program.Main(System.String[])
```
I have looked at and tried the code samples at [AppDomain.UnhandledException Event](https://msdn.microsoft.com/en-us/library/system.appdomain.unhandledexception(v=vs.71).aspx) however the EXE fails before that code gets executed, even when it's the first thing encountered in the Main().
It does occur to me as I write this that instantiating the object before Main() kicks in might have something to do with the exception handler not firing. What's be nice, though would be to know why I'm having the problem at all.
```
namespace NormanEmailHandler
{
class Program
{
static JScriptEngine JSengine = new JScriptEngine(WindowsScriptEngineFlags.EnableDebugging | WindowsScriptEngineFlags.EnableJITDebugging);
```
Comments: Okay, I'll give it a shot. The weird thing is that it was all working fine until halfway through today when it stopped working. I haven't figured out why. I've trapping the exception in a try/catch but it doesn't get caught. V8ScriptEngine is possible, but then how do I debug in Visual Studio? Think I need more than luck. Anyone want to pray?
I have a number of C# programs running under the scheduler in an Azure VM. All but two are currently working due to an error which identifies itself by a last run result of 0xE0434352.
In Event Viewer -> Windows Logs -> Application there are a number of errors listed, all of which say mostly the same as the following
```
Application: NormanEmailHandler.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.ComponentModel.Win32Exception at MS.Win32.UnsafeNativeMethods.RegisterClassEx(WNDCLASSEX_D) at MS.Win32.HwndWrapper..ctor(Int32, Int32, Int32, Int32, Int32, Int32, Int32, System.String, IntPtr, MS.Win32.HwndWrapperHook[]) at System.Windows.Threading.Dispatcher..ctor() at System.Windows.Threading.Dispatcher.get_CurrentDispatcher() at Microsoft.ClearScript.Windows.WindowsScriptEngine..ctor(System.String, System.String, Microsoft.ClearScript.Windows.WindowsScriptEngineFlags) at Microsoft.ClearScript.Windows.JScriptEngine..ctor(System.String, System.String, Microsoft.ClearScript.Windows.WindowsScriptEngineFlags) at Microsoft.ClearScript.Windows.JScriptEngine..ctor(Microsoft.ClearScript.Windows.WindowsScriptEngineFlags) at NormanEmailHandler.Program..cctor() Exception Info: System.TypeInitializationException at NormanEmailHandler.Program.Main(System.String[])
```
I have looked at and tried the code samples at [AppDomain.UnhandledException Event](https://msdn.microsoft.com/en-us/library/system.appdomain.unhandledexception(v=vs.71).aspx) however the EXE fails before that code gets executed, even when it's the first thing encountered in the Main().
It does occur to me as I write this that instantiating the object before Main() kicks in might have something to do with the exception handler not firing. What's be nice, though would be to know why I'm having the problem at all.
```
namespace NormanEmailHandler
{
class Program
{
static JScriptEngine JSengine = new JScriptEngine(WindowsScriptEngineFlags.EnableDebugging | WindowsScriptEngineFlags.EnableJITDebugging);
```
Comments: Okay, I'll give it a shot. The weird thing is that it was all working fine until halfway through today when it stopped working. I haven't figured out why. I've trapping the exception in a try/catch but it doesn't get caught. V8ScriptEngine is possible, but then how do I debug in Visual Studio? Think I need more than luck. Anyone want to pray?