title: UseLegacyPathHandling is not loaded properly from app.config runtime element
body: <p>I'm trying to use the new long path support at my app. In order to use it, without forcing clients to have the newest .net 4.6.2 version instelled on their machines, one should only add those elements to his app.config (see the link for more info <a href="https://blogs.msdn.microsoft.com/dotnet/2016/08/02/announcing-net-framework-4-6-2/" rel="nofollow noreferrer">https://blogs.msdn.microsoft.com/dotnet/2016/08/02/announcing-net-framework-4-6-2/</a>) :</p>
  
  <pre><code>&lt;startup&gt;
      &lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/&gt;
  &lt;/startup&gt;
  &lt;runtime&gt;
      &lt;AppContextSwitchOverrides value="Switch.System.IO.UseLegacyPathHandling=false" /&gt;
  &lt;/runtime&gt;
  </code></pre>
  
  <p>When I use it in my execution project it works perfectly. The problem is in my testing projects (which use Nunit). I've added app.config to my test project in the same way I've added it to the execution project. </p>
  
  <p>Using the ConfigurationManager class I've managed to ensure that app config indeed loaded (in short: using an app setting which i was able to retrieve in a unit test). </p>
  
  <p>Using ConfigurationManager.GetSection("runtime"), I even managed to ensure the runtime element has been loaded properly (_rawXml value is the same as in app.config).</p>
  
  <p>But (!) for some reason the app config runtime element is not influence the UseLegacyPathHandling variable and therefore all of my calls with long path fail. </p>
  
  <p>I guess the problem is somehow relates to the fact that testing projects become dll's that are loaded using the Nunit engine, which is the execution entry point.</p>
  
  <p>I'm facing the exact same problem in another project I have, which is a dll loaded by Office Word application. I believe the problem is the same in both cases and derived from the fact that the projects are not meant to be an execution entry point.</p>
  
  <p>It's important to understand that I've no access to the executions their self (Word Office or Nunit) and therefore I can't configure them myself.</p>
  
  <p>Is there an option to somehow make the AppContextSwitchOverrides get loaded from scratch dynamically? Other ideas will be most welcome. Thanks.</p>