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

Problem after embedding resources

4 Answers 182 Views
FiddlerCore
This is a migrated thread and some comments may be shown as answers.
kdn
Top achievements
Rank 1
kdn asked on 03 Aug 2019, 02:06 AM

Hello,

 

I have used the sample app provided, which works well. Now I wanted to avoid have so many dll's with the program and make it portable, so I used Fody Cosutra which embeds all resources into the single exe file. Now I seem to be getting an error, it appears the current proxy settings are not being written correctly, any advice on how to get around this?

The code:

    //string directory = Path.Combine(assemblyDirectory, "lib", "NetworkConnections");
 
            string directory = assemblyDirectory;
 
            using (AssemblyCatalog assemblyCatalog = new AssemblyCatalog(typeof(NetworkConnectionsManager).Assembly))
             using (DirectoryCatalog directoryCatalog = new DirectoryCatalog(directory))
 
                 
 
            using (AggregateCatalog aggregateCatalog = new AggregateCatalog(assemblyCatalog, directoryCatalog))
            {
                compositionContainer = new CompositionContainer(aggregateCatalog);
                networkConnectionsManager = compositionContainer.GetExportedValue<NetworkConnectionsManager>();
                 
            }
 
            networkConnectionsToUpstreamProxySettingsMap = networkConnectionsManager
                .GetAllConnectionFullNames()
                .ToDictionary(cn => cn, cn => networkConnectionsManager.GetCurrentProxySettingsForConnection(cn));
        }

 

 

the error: 

System.Collections.Generic.KeyNotFoundException: 'The given key was not present in the dictionary.'

occurs on this line:

ProxySettings upstreamProxy = networkConnectionsToUpstreamProxySettingsMap[new NetworkConnectionFullName("WinINet", "DefaultLAN")];

 

big thanks if anyone can help me solve this!

 

4 Answers, 1 is accepted

Sort by
0
kdn
Top achievements
Rank 1
answered on 05 Aug 2019, 06:07 AM

I went back and created a new very simple project, all I do is call FiddlerApplication.Startup(startupSettings). I still get thrown an error after embedding as a resource, using Fody weavers, or ILMerge:

unhandled Exception: System.ArgumentException: The path is not of a legal form.
   at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.InternalGetDirectoryName(String path)
   at Fiddler.Proxy..ctor(Boolean isPrimary, ProxySettings upstreamProxySettings)
   at Fiddler.FiddlerApplication.Startup(FiddlerCoreStartupSettings startupSettings)

 

Looks like FiddlerCore trying to call Telerik.NetworkConnections is causing this issue, anyway to fix this?

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 07 Aug 2019, 04:43 PM
Hi Kdn,

Thank you for providing the error messages and the code snippet. Although, it is difficult to troubleshoot. Could you provide the project with implementation details?

Please let me know if you need any additional information. Thank you.

Regards,

Eric R | Technical Support Engineer
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
kdn
Top achievements
Rank 1
answered on 11 Aug 2019, 04:42 AM

Hello,

 

you can replciate this issue with the FiddlerCore sample app. Build the app in VS, then try any of these emthods to get a standalone exe file -

 

1) Set the dll files as embedded resource in VS and set to do not copy to output folder - exe will crash

2) In Visual studio, add fody and fody costura to the project. A single exe will be output but will crash 

3) Build in visual studio, use ILmerge to combine dll into exe. Output exe will crash

 

I have not recorded the exact error messages you get for each scenario, but all along the same lines that a resource cannot be found in the expected folder.

thanks

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 12 Aug 2019, 03:50 PM
Hi Kdn,

Thank you for providing the implementation information. Although, I am only able to provide support for Fiddler Core.

With that said, after a quick look on the project homepage, the assemblies need to be marked "Copy Local". See the Details Section of the Project readme for more information.

Additionally, this would be better handled by leveraging the Fody/Costura community or StackOverflow.

I hope this helps. Please let me know if you have any additional information regarding Fiddler Core. Thank you.

Regards,

Eric R | Technical Support Engineer
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
FiddlerCore
Asked by
kdn
Top achievements
Rank 1
Answers by
kdn
Top achievements
Rank 1
Eric R | Senior Technical Support Engineer
Telerik team
Share this question
or