NullReferenceException:at AutoTamperRequestBefore(Session oSession)

1 posts, 0 answers
  1. yang
    yang avatar
    3 posts
    Member since:
    Jun 2016

    Posted 07 Jun Link to this post

    Code:
    namespace ClassLibrary2
    {
        public class Class1 : IAutoTamper, IFiddlerExtension
        {
            private UI ui;
            private bool bLoaded;
            ...
            public Class1() {
                
                bLoaded= false;
            }
            public void OnLoad()
            {
                this.ui = new UI();           
                this.bLoaded = true;


            }
            public void OnBeforeUnload()
            {  /*noop*/

            }

            public void AutoTamperRequestBefore(Session oSession)
            {  /*noop*/

                if (bLoaded && url.Contains(oSession.hostname)) {
                  .....
                }

            }
            public void AutoTamperRequestAfter(Session oSession)
            {

            }
            public void AutoTamperResponseBefore(Session oSession)
            {          
                 .....
            }
            public void AutoTamperResponseAfter(Session oSession)
            { /* noop */
                

            }
            public void OnBeforeReturningError(Session oSession) { /* noop */ }


        }
    }

    Error:
    ---------------------------
    Uncaught Exception in Session #1
    ---------------------------
    Fiddler has encountered an unexpected problem. If you believe this is a bug in Fiddler, please copy this message by hitting CTRL+C, and submit a bug report using the Help | Send Feedback menu.

    未将对象引用设置到对象的实例。

    Type: System.NullReferenceException
    Source: ClassLibrary2
       在 ClassLibrary2.Class1.AutoTamperRequestBefore(Session oSession)

       在 Fiddler.FiddlerExtensions.DoAutoTamperRequestBefore(Session oSession)

       在 Fiddler.Session._executeObtainRequest()

       在 Fiddler.Session.RunStateMachine()

       在 Fiddler.Session.Execute(Object objThreadState)


    Fiddler v4.6.2.2 (x64 AMD64) [.NET 4.0.30319.42000 on Microsoft Windows NT 10.0.10586.0] 
    ---------------------------
    确定   
    ---------------------------

Back to Top