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!