title: System.Xml.XmlException: Invalid character in the given encoding. Line 1, position 1. When using Nuget
body: <p>For the last 24hrs Nuget seems to be throwing a weird error to me. </p>
  
  <p>Everytime I try to install or uninstall a package.. it fails with the following error: </p>
  
  <pre><code>System.Xml.XmlException: Invalid character in the given encoding. Line 1, position 1.
  </code></pre>
  
  <p>The total stack is:</p>
  
  <pre><code>Attempting to gather dependencies information for package 'Microsoft.AspNet.WebApi.Client.5.2.3' with respect to project 'User Interface\SMRH.LPIC.Web', targeting '.NETFramework,Version=v4.5.1'
  Attempting to resolve dependencies for package 'Microsoft.AspNet.WebApi.Client.5.2.3' with DependencyBehavior 'Lowest'
  Resolving actions to install package 'Microsoft.AspNet.WebApi.Client.5.2.3'
  Resolved actions to install package 'Microsoft.AspNet.WebApi.Client.5.2.3'
  For adding package 'Microsoft.AspNet.WebApi.Client.5.2.3' to project 'SMRH.LPIC.Web' that targets 'net451'.
  For adding package 'Microsoft.AspNet.WebApi.Client.5.2.3' to project    'SMRH.LPIC.Web' that targets 'net451'.
  Package 'Microsoft.AspNet.WebApi.Client.5.2.3' already exists in folder   'F:\TFS\DevTeamCode\LPIC\SMRH.LPIC\packages'
  Added reference 'System.Net.Http.Formatting' to project 'SMRH.LPIC.Web'.
  Added package 'Microsoft.AspNet.WebApi.Client.5.2.3' to 'packages.config'
  Successfully installed 'Microsoft.AspNet.WebApi.Client 5.2.3' to SMRH.LPIC.Web
  Added file 'web.config'.
  Install failed. Rolling back...
  System.Xml.XmlException: Invalid character in the given encoding. Line 1, position 1.
  at System.Xml.XmlTextReaderImpl.Throw(Exception e)
  at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
  at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32&amp; bytesCount, Int32&amp; charsCount)
  at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)
  at System.Xml.XmlTextReaderImpl.ReadData()
  at System.Xml.XmlTextReaderImpl.SwitchEncoding(Encoding newEncoding)
  at System.Xml.XmlTextReaderImpl.SwitchEncodingToUTF8()
  at System.Xml.XmlTextReaderImpl.ParseXmlDeclaration(Boolean isTextDecl)
  at System.Xml.XmlTextReaderImpl.Read()
  at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
  at NuGet.ProjectManagement.XmlUtility.LoadSafe(Stream input, LoadOptions options)
  at NuGet.ProjectManagement.XmlUtility.GetDocument(String root, String path)
  at NuGet.ProjectManagement.XmlUtility.GetOrCreateDocument(XName rootName, String root, String path, INuGetProjectContext nuGetProjectContext)
  at NuGet.PackageManagement.VisualStudio.BindingRedirectManager.GetConfiguration()
  at NuGet.PackageManagement.VisualStudio.BindingRedirectManager.AddBindingRedirects(IEnumerable`1 bindingRedirects)
  at NuGet.PackageManagement.VisualStudio.RuntimeHelpers.&lt;AddBindingRedirectsAsync&gt;d__3.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at NuGet.PackageManagement.VisualStudio.RuntimeHelpers.&lt;AddBindingRedirectsAsync&gt;d__2.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at NuGet.PackageManagement.VisualStudio.RuntimeHelpers.&lt;AddBindingRedirectsAsync&gt;d__2.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at NuGet.PackageManagement.VisualStudio.RuntimeHelpers.&lt;AddBindingRedirectsAsync&gt;d__0.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at NuGet.PackageManagement.VisualStudio.VSMSBuildNuGetProjectSystem.&lt;&lt;AddBindingRedirects&gt;b__55_0&gt;d.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
  at NuGet.PackageManagement.VisualStudio.VSMSBuildNuGetProjectSystem.AddBindingRedirects()
  at NuGet.ProjectManagement.MSBuildNuGetProject.PostProcessAsync(INuGetProjectContext nuGetProjectContext, CancellationToken token)
  at NuGet.PackageManagement.NuGetPackageManager.&lt;ExecuteNuGetProjectActionsAsync&gt;d__42.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
  at NuGet.PackageManagement.NuGetPackageManager.&lt;ExecuteNuGetProjectActionsAsync&gt;d__42.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at NuGet.PackageManagement.UI.UIActionEngine.&lt;ExecuteActionsAsync&gt;d__5.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
  at NuGet.PackageManagement.UI.UIActionEngine.&lt;PerformActionAsync&gt;d__3.MoveNext()
  ========== Finished ==========
  </code></pre>
  
  <p>It won't give me what file it is failing at. Deleting the packages folder and restoring it did not work either.</p>
  
  <p>I have checked the web.config and it does not seem to have formatting issues. </p>
  
  <p>Rebooted PC and VS but no luck.</p>
  
  <p><strong>Using Visual Studio 2015 Enterprise, with C# Environment.</strong> </p>