My project has recently started to throw the following error:
Unexpected error: Could not load type 'Newtonsoft.Json.Serialization.CamelCaseNamingStrategy' from assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'.
at System.Reflection.CustomAttribute._GetPropertyOrFieldData(RuntimeModule pModule, Byte** ppBlobStart, Byte* pBlobEnd, String& name, Boolean& bIsProperty, RuntimeType& type, Object& value)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at Newtonsoft.Json.Utilities.ReflectionUtils.GetAttributes[T](ICustomAttributeProvider attributeProvider, Boolean inherit)
at Newtonsoft.Json.Utilities.ReflectionUtils.GetAttribute[T](ICustomAttributeProvider attributeProvider, Boolean inherit)
at Newtonsoft.Json.Serialization.JsonTypeReflector.GetAttribute[T](Type type)
at Newtonsoft.Json.Utilities.ThreadSafeStore`2.AddValue(TKey key)
at Newtonsoft.Json.Utilities.ThreadSafeStore`2.Get(TKey key)
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)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Extension.Command.ClientInitializer() in C:\project\Command.cs:line 18
in Command.Initializer
I don't really know what I might have changed to make this appear.
I'm using fody.costura to bundle all my dependencies and I've made sure it's bundled.
Here are the properties of the Newtonsoft.Json dependency:
Name : Newtonsoft.Json
Aliases : global
Copy Local : True
Culture :
Description : Json.NET is a popular high-performance JSON framework for .NET
Embed Interop Types : False
File Type : Assembly
Identity : Newtonsoft.Json
Path : C:\project\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll
Resolved : True
Runtime Version : v4.0.30319
Specific Version : True
Strong Name : True
Version : 12.0.0.0
My project is a .NET Framework 4.6.1 Class Library project.
Any suggestions as to what might be the problem?
Thanks!