This is a migrated thread and some comments may be shown as answers.

NullReferenceException:at AutoTamperRequestBefore(Session oSession)

0 Answers 15 Views
Extensions and Customization
This is a migrated thread and some comments may be shown as answers.
yang
Top achievements
Rank 1
yang asked on 07 Jun 2016, 09:28 AM

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] 
---------------------------
确定   
---------------------------

No answers yet. Maybe you can help?

Tags
Extensions and Customization
Asked by
yang
Top achievements
Rank 1
Share this question
or