[CLOSED] [#165] Exceptions in DirectMethods

  1. #1

    [CLOSED] [#165] Exceptions in DirectMethods

    Last edited by Daniil; Jun 28, 2013 at 3:08 PM. Reason: [CLOSED]
  2. #2
    Hi,

    It works if remove "Shared" from the DirectMethod definition.

    Does VB "Shared" just mean C# "static", right?
    http://www.dotnetperls.com/shared

    We will investigate a possibility to support "Shared".

    By the way, here is an example of handling Exceptions with DirectMethods.
    https://examples1.ext.net/#/Events/D...ds/Exceptions/
  3. #3
    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
    Last edited by Daniil; Aug 29, 2012 at 3:07 PM. Reason: Wrapped the Exception in [CODE] tags
  4. #4
    Quote Originally Posted by Daniil View Post
    Does VB "Shared" just mean C# "static", right?
    http://www.dotnetperls.com/shared

    We will investigate a possibility to support "Shared".
    Well, "Shared" is supported the same way as C# "static" is.

    The problem is the fact that static (Shared) DirectMethods don't use global ResourceManager and Web.config RethrowAjaxExceptions settings. So, for static (Shared) DirectMethods please use the RethrowException setting.

    We will try to change it in Ext.NET v2. Thanks for pointing it out. But in Ext.NET v1 the things will be left as they are now.

    Quote Originally Posted by georgek View Post
    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.
    This exception is thrown by the Invoke method.

    We take an inner Exception for non static (non Shared) DirectMethods. So, you can take an inner exception for static (Shared) exception manually.
  5. #5
    Quote Originally Posted by Daniil View Post
    The problem is the fact that static (Shared) DirectMethods don't use global ResourceManager and Web.config RethrowAjaxExceptions settings. So, for static (Shared) DirectMethods please use the RethrowException setting.

    We will try to change it in Ext.NET v2. Thanks for pointing it out. But in Ext.NET v1 the things will be left as they are now.
    We created an Issue for v2.
    https://github.com/extnet/Ext.NET/issues/165
  6. #6
    Quote Originally Posted by Daniil View Post
    Quote Originally Posted by Daniil View Post
    The problem is the fact that static (Shared) DirectMethods don't use global ResourceManager and Web.config RethrowAjaxExceptions settings. So, for static (Shared) DirectMethods please use the RethrowException setting.

    We will try to change it in Ext.NET v2. Thanks for pointing it out. But in Ext.NET v1 the things will be left as they are now.
    We created an Issue for v2.
    https://github.com/extnet/Ext.NET/issues/165
    It has been implemented for Ext.NET v2.

Similar Threads

  1. Replies: 5
    Last Post: Dec 13, 2012, 8:27 AM
  2. [CLOSED] How to properly handle exceptions in Direct Events?
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Feb 07, 2012, 5:00 PM
  3. Bugs? on DirectMethods/Exceptions/
    By ErhWen in forum 1.x Help
    Replies: 1
    Last Post: Sep 16, 2010, 12:21 AM
  4. Catch Exceptions
    By Dominik in forum 1.x Help
    Replies: 1
    Last Post: Jun 10, 2010, 7:39 AM
  5. GlobalConfig throwing exceptions
    By NestorLeone in forum 1.x Help
    Replies: 2
    Last Post: Sep 08, 2009, 5:11 PM

Tags for this Thread

Posting Permissions