You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: extend-fiddler/extendwithdotnet.md
+39-41Lines changed: 39 additions & 41 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,28 +23,26 @@ See [Build extension assemblies to run in both Fiddler Classic versions 2 and 4]
23
23
## Debugging
24
24
25
25
+ To ensure that exceptions and other extension-related errors are not silently caught: [set](slug://ExtensionsForv2Andv4) the `fiddler.debug.extensions.showerrors` preference to **True**.
26
-
+ To output logging information to the **Log** tab: [set][1] the `fiddler.debug.extensions.verbose`
27
-
28
-
[1]: http://fiddler.wikidot.com/prefsaction
26
+
+ To output logging information to the **Log** tab: set the `fiddler.debug.extensions.verbose`
29
27
30
28
## Direct Fiddler Classic to load extension assemblies
31
29
32
30
+ To make the extensions available to the current user, install extension assembly DLLs to:
33
31
34
-
```
35
-
%localappdata%\Programs\Fiddler\Scripts
36
-
OR
37
-
%userprofile%\Documents\Fiddler2\Scripts
38
-
```
32
+
```txt
33
+
%localappdata%\Programs\Fiddler\Scripts
34
+
OR
35
+
%userprofile%\Documents\Fiddler2\Scripts
36
+
```
39
37
40
38
+ Set the **Fiddler.RequiredVersion** attribute in your **AssemblyInfo.cs** file (or elsewhere in your code) as follows:
41
39
42
-
```c#
43
-
using Fiddler;
40
+
```c#
41
+
usingFiddler;
44
42
45
-
// Extension requires Fiddler Classic 2.2.8.6+ because it uses types introduced in v2.2.8...
46
-
[assembly: Fiddler.RequiredVersion("2.2.8.6")]
47
-
```
43
+
// Extension requires Fiddler Classic 2.2.8.6+ because it uses types introduced in v2.2.8...
44
+
[assembly: Fiddler.RequiredVersion("2.2.8.6")]
45
+
```
48
46
49
47
## Sample Extension: Step by Step
50
48
@@ -66,41 +64,41 @@ See [Build extension assemblies to run in both Fiddler Classic versions 2 and 4]
66
64
+ In the Solution Explorer, right click the project. Choose Properties.
67
65
+ On the Build Events tab, add the following to the Post-build event command line:
Copy file name to clipboardExpand all lines: extend-fiddler/extensionsforv2andv4.md
+25-25Lines changed: 25 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,51 +9,51 @@ position: 11
9
9
10
10
+ If you want your extension Assembly to run in both Fiddler2 and Fiddler4, build it for .NET Framework v2 and avoid taking any dependencies on any classes that were removed or moved in the later version of the Framework. (The only instance I'm aware of is the Microsoft JScript.NET code compiler, whose classes were moved around a bit).
11
11
12
-
You'll also need to ensure that if you use any methods that are deprecated (for example, calling **Assembly.LoadFrom** with the overload that takes an **Evidence** parameter) you do so only conditionally. For example:
13
-
14
-
```c#
15
-
if (CONFIG.bRunningOnCLRv4)
16
-
{
17
-
a = Assembly.LoadFrom(oFile.FullName);
18
-
}
19
-
else
20
-
{
21
-
a = Assembly.LoadFrom(oFile.FullName, evidenceFiddler);
22
-
}
23
-
```
12
+
You'll also need to ensure that if you use any methods that are deprecated (for example, calling `Assembly.LoadFrom` with the overload that takes an `Evidence` parameter) you do so only conditionally. For example:
All of the extensions from the Fiddler Classic website are compiled against Fiddler Classic v2.
26
26
27
27
+ Alternatively, you can simply build two versions of your DLL, one version targeting .NET Framework v4 and one targeting .NET Framework v2.
28
28
29
29
This is how Fiddler Classic itself is built. Basically, just add a "clone" version of your v2-targeted Project to the same Solution. Use the **Add > Existing Item** context menu to add the .CS files from the v2-targeted project to the v4-targeted project, but when selecting the files, be very sure to use the split button on the file picker dialog and choose **Add as Link**. On the v4 Project's **Properties > Build** tab, add a **Conditional Compilation** symbol like DOTNET4. You can then put any .NETv4-specific code behind conditional compilation:
30
30
31
-
```c#
32
-
#if DOTNET4
31
+
```c#
32
+
#ifDOTNET4
33
33
34
-
// ... code targeting .NETv4
34
+
// ... code targeting .NETv4
35
35
36
-
#else
36
+
#else
37
37
38
-
// ... code targeting .NETv2
38
+
// ... code targeting .NETv2
39
39
40
-
#endif
41
-
```
40
+
#endif
41
+
```
42
42
43
43
Your extension may install the appropriately-targeted version based on the content of the **InstalledVersion** registry key found inside:
44
44
45
-
```
46
-
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fiddler2
47
-
```
45
+
```txt
46
+
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fiddler2
47
+
```
48
48
49
49
The .NET2 version of Fiddler Classic is much more popular than the .NETv4 version at this time. When the .NET Framework v4.5 is released, I may move the v4 project over to v4.5. Among other things, that would allow me to take advantage of the new built-in .ZIP classes in that later framework.
50
50
51
51
+ What about the RequiredVersion attribute?
52
52
53
53
Fiddler Classic v4 is "smart"-- if your extension specifies
54
54
55
-
```
56
-
[assembly: Fiddler.RequiredVersion("2.1.0.1")]
57
-
```
55
+
```txt
56
+
[assembly: Fiddler.RequiredVersion("2.1.0.1")]
57
+
```
58
58
59
59
When Fiddler Classic v4 loads it, it will require version 4.3.9.9 or later.
Copy file name to clipboardExpand all lines: extend-fiddler/importerexporterinterfaces.md
+25-25Lines changed: 25 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,48 +9,48 @@ position: 7
9
9
10
10
## Thread Safety and FiddlerCore
11
11
12
-
+ Currently, the **ISessionImporter** and **ISessionExporter** interfaces are called on the **MAIN** UI thread. This is almost certain to change in the future, so you should ensure that your classes are thread safe and that they do not attempt to directly manipulate the Fiddler Classic UI.
12
+
+ Currently, the `ISessionImporter` and `ISessionExporter` interfaces are called on the **MAIN** UI thread. This is almost certain to change in the future, so you should ensure that your classes are thread safe and that they do not attempt to directly manipulate the Fiddler Classic UI.
13
13
14
14
+ Manipulation of the Fiddler Classic UI is further ill-advised because Fiddler Classic itself may not be loaded; FiddlerCore may be hosting your Importer/Exporter directly. In order to support FiddlerCore, it's advised that you support the Filename key (with string value of a fully-qualified path) in the dictOptions parameter, and consider supporting a Silent key (value as boolean) as well.
15
15
16
16
## The ISessionImporter Interface
17
17
18
-
Extensions that implement the **ISessionImporter** interface (which implements the **IDisposable** interface) are called when the user uses the **File > Import** menu option.
18
+
Extensions that implement the `ISessionImporter` interface (which implements the `IDisposable` interface) are called when the user uses the **File > Import** menu option.
The method returns an array of **Session** objects created from the Import of the data.
29
+
The method returns an array of `Session` objects created from the Import of the data.
30
30
31
-
The **dictOptions** dictionary may be null, or may contain a set of string-keyed objects. Most importers support specification of a filename. For example:
31
+
The `dictOptions` dictionary may be null, or may contain a set of string-keyed objects. Most importers support specification of a filename. For example:
If the Cancel flag is set on the **ProgressCallbackEventArgs** object after being passed to the **evtProgressNotifications** callback, import or export should gracefully terminate as soon as possible.
44
-
45
-
```c#
46
-
public class ProgressCallbackEventArgs: EventArgs
47
-
{
48
-
public ProgressCallbackEventArgs(float flCompletionRatio, string sProgressText)
0 commit comments