Assembly References for FiddlerScript not working

1 Answer 11 Views
Fiddler Classic Windows
Steve
Top achievements
Rank 1
Steve asked on 25 Apr 2024, 01:49 PM

Hi

I am using Fiddler Classic v.5.0.20242.10753 for .NET 4.6.2 64-bit on Windows Server 2012R2 (don't ask!)

I am also using FiddlerScript in C# mode.  My use case is that I am trying to create a temporary fix for a legacy service that is responding with incorrectly derived values in an XML payload.  I can force all clients of this service to access it via Fiddler as a proxy, and I wanted to use FiddlerScript to modify the response to correct some of the data, as it can be derived from other parts of the response.

I did a very very rough PoC by catching the specific calls in OnBeforeResponse and making an arbitrary change.  What I have then tried to do is use the System.XML XmlDocument object, pass it the response body when instantiating, and working from there.

THE PROBLEM:  I have added "using System.XML;" to the script.  I have also added "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.XML.dll" to the References field in Fiddler under Tools -> Options -> Scripting and restarted Fiddler Classic.  However, when saving the script, I get an error "The type or namespace name 'XML' does not exist in the namespace 'System' (are you missing an assembly reference?)"

I have tried just about everything I can think of to make that reference:
 - adding directly to the dll in the Windows dir
 - copying the dll(s) to the same DIR as the Fiddler.exe (as suggested in your docs)
 - adding the XML dlls to the GAC

Nothing I do seems to solve this problem.  I thought it might be a .NET version issue, but I have 4.6.2 installed.

How do I properly reference other .NET assemblies that I want to use in script? 

Thanks,
Steve.

1 Answer, 1 is accepted

Sort by
0
Nick Iliev
Telerik team
answered on 29 Apr 2024, 06:23 AM

Hello Steve,

 

This is a known limitation (reported here) when using C# as a language in FiddlerScript. Currently, as a workaround, you can switch back to JScript.NET (again through the Tools > Options > Scripting> Language option), and then the reference to System.XML will work as expected.

 

Regards,
Nick Iliev
Progress Telerik

A brand new ThemeBuilder course was just added to the Virtual Classroom. The training course was designed to help you get started with ThemeBuilder for styling Telerik and Kendo UI components for your applications. You can check it out at https://learn.telerik.com
Steve
Top achievements
Rank 1
commented on 29 Apr 2024, 11:53 AM

Hi Nick

Thanks for the reply.  That link refers to third-party libraries.  I'm talking about core System namespace here, which in fact even Fiddler is itself using under the covers (according to Process Explorer looking at the Fiddler2.exe process).  Are you saying that references in general will not work with C#?  That doesn't make a lot of sense given it's the same CLR under the covers, but so be it if that's true.  If so, a documentation update would sure help people not waste hours (or days in my case) trying to get this to work.

Shame the 'solution' would be to go back to JScript.  var I can't var say var that I'm super var happy var working in var JScript var as it's var somewhat var limiting var IMHO.

Thanks,
Steve.

Tags
Fiddler Classic Windows
Asked by
Steve
Top achievements
Rank 1
Answers by
Nick Iliev
Telerik team
Share this question
or