Home > database >  VS2022 Installer: Impossible to install/repair because of System.Numerics and/or Newtonsoft.Json.Uti
VS2022 Installer: Impossible to install/repair because of System.Numerics and/or Newtonsoft.Json.Uti

Time:07-21

This issue started today (or very recently) with a .NET 4.7.2 project that stopped running on my Win10, VS2022 Enterprise machine complaining about some missing or mismatch version of System.Numerics library. Automatic binding redirect was already enabled.

When I launched VS Installer, nothing showed up (neither installed nor available). However VS2022 was still running ok. The more I tried to fix things, the worse it got. I already wasted hours trying to reinstall, reinstall online, repair, uninstall from add/remove programs, uninstall manually using installcleanup.exe, renaming Installer folder, removing all assemblies from the GAC, etc.

To make it short, the error that shows up during Installer installation is the following:
Unable to acquire update installer

The error in the logs is always the same:

VisualStudio Bootstrapper:15/07/2022 14:09:48: Caught Exception: Type = TypeInitializationException,
    Message = The type initializer for 'Newtonsoft.Json.Utilities.ConvertUtils' threw an exception.,
    StackTrace =    at Newtonsoft.Json.Utilities.ConvertUtils.GetTypeCode(Type t, Boolean& isEnum)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.IsJsonPrimitiveType(Type t)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract(Type objectType)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract(Type type)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at Microsoft.VisualStudio.Setup.Utility.JsonUtility.ParseNameValuePairJson(String jsonContents)
   at Microsoft.VisualStudio.Setup.Utility.JsonUtility.ParseNameValuePairJsonFile(IServiceProvider services, String filePath)
   at Microsoft.VisualStudio.Setup.Bootstrapper.Program.Parse(String[] args, IServiceProvider serviceProvider, IC2RSignatureReaderInterop c2rSignatureReader, String entryAssemblyProcessName, String entryAssemblyProcessFullName)
InnerException:Type = FileNotFoundException,
    Message = Could not load file or assembly 'System.Numerics, Version=4.0.0.0, Culture=neutral,
    PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.,
    StackTrace =    at Newtonsoft.Json.Utilities.ConvertUtils..cctor()

Note: I already looked up this issue a lot, so please do not suggest obvious widely referenced solutions like "Add/Remove programs" or "Repair button". Also the "Report problem" button on the installer window that I am able to launch by renaming installer folder does not work. Offline installation via command line also does not work.

Has anyone already experienced this issue and can propose a solution other than reinstalling the whole OS? It looks the installer is not able to parse some temp/boostraper.json file because of this exception, but I have no idea how to fix this.

CodePudding user response:

Turns out I did remove a GAC, but that was not the GAC (at least not the only one). Based on another answer and MS forums, deleting every GAC* folder from C:\Windows\assembly\ seems to have done the trick. The "other one" was somewhere in AppData folder.

  • Related