Genbox / VirusTotalContextMenu

A context menu that allows you to right click any file in Windows Explorer and scan it using VirusTotal.
90 stars 8 forks source link

Operating system that specifies regional preferences #7

Open Blabbone opened 1 year ago

Blabbone commented 1 year ago

Yes, it appears that the error is caused by a problem when deserializing a JSON object that is returned by a web service called VirusTotal. Specifically, the code indicates that an exception occurred when creating the "YearMonthDayConverter" object of the "DateTimeParsers" class in the VirusTotalNet.Internal library. This could be caused by a problem with the system's culture configuration, as suggested by the "CultureNotFoundException" error.

It is possible that there is an incorrect or incomplete configuration of the development environment, such as a language setting or cultural configuration not supported by the system. It could also be a problem with the VirusTotalNet.Internal library itself. A possible solution would be to check the system's cultural configuration or look for an updated version of the library that would solve the problem.

Getting report for VirusTotalContextMenu.exe
An error happened:
Newtonsoft.Json.JsonException: Error creating 'VirusTotalNet.Internal.DateTimeParsers.YearMonthDayConverter'.
 ---> System.Globalization.CultureNotFoundException: Only the invariant culture is supported in globalization-invariant mode. See https://aka.ms/GlobalizationInvariantMode for more information. (Parameter 'name')
en-us is an invalid culture identifier.
   at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride)
   at System.Globalization.CultureInfo..ctor(String name)
   at VirusTotalNet.Internal.DateTimeParsers.YearMonthDayConverter..ctor()
   at lambda_method5(Closure )
   at Newtonsoft.Json.Serialization.JsonTypeReflector.<>c__DisplayClass22_0.<GetCreator>b__0(Object[] parameters)
   --- End of inner exception stack trace ---
   at Newtonsoft.Json.Serialization.JsonTypeReflector.<>c__DisplayClass22_0.<GetCreator>b__0(Object[] parameters)
   at Newtonsoft.Json.Serialization.JsonTypeReflector.GetJsonConverter(Object attributeProvider)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.SetPropertySettingsFromAttributes(JsonProperty property, Object attributeProvider, String name, Type declaringType, MemberSerialization memberSerialization, Boolean& allowNonPublicAccess)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateProperties(Type type, MemberSerialization memberSerialization)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateObjectContract(Type objectType)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract(Type objectType)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey , Func`2 )
   at Newtonsoft.Json.Utilities.ThreadSafeStore`2.Get(TKey key)
   at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract(Type type)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.GetContract(Type type)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.GetContractSafe(Type type)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateDictionary(IDictionary dictionary, JsonReader reader, JsonDictionaryContract contract, JsonProperty containerProperty, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
   at VirusTotalNet.VirusTotal.GetResponse[T](String url, HttpMethod method, HttpContent content)
   at VirusTotalNet.VirusTotal.GetFileReportAsync(String resource)
   at VirusTotalNet.VirusTotal.GetFileReportAsync(FileInfo file)
   at VirusTotalContextMenu.Program.VirusScanFile(String filePath)
   at VirusTotalContextMenu.Program.Main(String[] args)
Genbox commented 1 year ago

I thought I only needed the invariant culture to parse datetimes. Turned out to be wrong.

Should no longer be an issue in the 1.8.0 release.