Problem after embedding resources

5 posts, 0 answers
  1. kdn
    kdn avatar
    4 posts
    Member since:
    Feb 2014

    Posted 02 Aug 2019 Link to this post

    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!

     

  2. kdn
    kdn avatar
    4 posts
    Member since:
    Feb 2014

    Posted 05 Aug 2019 Link to this post

    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?

  3. Eric R | Senior Technical Support Engineer
    Admin
    Eric R | Senior Technical Support Engineer avatar
    419 posts

    Posted 07 Aug 2019 Link to this post

    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
  4. kdn
    kdn avatar
    4 posts
    Member since:
    Feb 2014

    Posted 10 Aug 2019 in reply to Eric R | Senior Technical Support Engineer Link to this post

    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

  5. Eric R | Senior Technical Support Engineer
    Admin
    Eric R | Senior Technical Support Engineer avatar
    419 posts

    Posted 12 Aug 2019 Link to this post

    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
Back to Top