Thank you Daniil.
Once I removed "Shared" the exception got to my error handler. However it is still wrapped up into a TargetInvocationException. I can work around it but if you know what causes TargetInvocationException and how to get rid of it please let me know. See exception info below with RethrowException On and Off.
Error with
<DirectMethod(RethrowException:=False)>
System.Exception: my test exception at ASP.test_aspx.TestError(String s) in C:\TFS\ScrumVMS\VMS - 6.0.5\WWWROOT\test.aspx:line 15
Error with
<DirectMethod(RethrowException:=True)>
Type : System.Reflection.TargetInvocationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : Exception has been thrown by the target of an invocation.
Source : mscorlib
Help link :
Data : System.Collections.ListDictionaryInternal
TargetSite : System.Object _InvokeMethodFast(System.IRuntimeMethodInfo, System.Object, System.Object[], System.SignatureStruct ByRef, System.Reflection.MethodAttributes, System.RuntimeType)
Stack Trace : at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Ext.Net.DirectMethod.Invoke(Object target, HttpContext context, ParameterCollection args)
at Ext.Net.ResourceManager.RaisePostBackEvent(String eventArgument)
at Ext.Net.ResourceManager.Page_AjaxLoadComplete(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Page.OnLoadComplete(EventArgs e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Inner Exception
---------------
Type : System.Exception, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : my test exception
Source : App_Web_test.aspx.cdcab7d2.4wyfoexr
Help link :
Data : System.Collections.ListDictionaryInternal
TargetSite : System.String TestError(System.String)
Stack Trace : at ASP.test_aspx.TestError(String s) in C:\TFS\ScrumVMS\VMS - 6.0.5\WWWROOT\test.aspx:line 15