title: Crash in C# Class Library when i use it
body: <p>Source/destination types</p>
  
  <pre><code>public struct MyStruct
  {
      public int FirstText { get; set; }
      public int SecondText { get; set; }
  }
  </code></pre>
  
  <p>Source/destination JSON</p>
  
  <pre><code>{FirstText:1,SecondText:2}
  </code></pre>
  
  <p>Expected behavior</p>
  
  <p>When I use it in a single exe demo:
      1 - 2</p>
  
  <p>Actual behavior</p>
  
  <p>When I use it in a C# Class Library, it crashes:</p>
  
  <pre><code>System.Reflection.TargetInvocationException: Exception has been thrown by the ta
  rget of an invocation. ---&gt; System.Security.SecurityException: Request failed.
     at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOn
  ly, Boolean noCheck, Boolean&amp; canBeCached, RuntimeMethodHandleInternal&amp; ctor, Bo
  olean&amp; bNeedSecurityCheck)
     at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipChec
  kThis, Boolean fillCache, StackCrawlMark&amp; stackMark)
     at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean s
  kipCheckThis, Boolean fillCache, StackCrawlMark&amp; stackMark)
     at System.Activator.CreateInstance(Type type, Boolean nonPublic)
     at System.Activator.CreateInstance(Type type)
     at Newtonsoft.Json.Utilities.LateBoundReflectionDelegateFactory.&lt;&gt;c__DisplayC
  lass9`1.&lt;CreateDefaultConstructor&gt;b__7()
     at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject
  (JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMem
  ber, JsonProperty containerProperty, String id, Boolean&amp; createdFromNonDefaultCr
  eator)
     at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(Js
  onReader reader, Type objectType, JsonContract contract, JsonProperty member, Js
  onContainerContract containerContract, JsonProperty containerMember, Object exis
  tingValue)
     at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInte
  rnal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty mem
  ber, JsonContainerContract containerContract, JsonProperty containerMember, Obje
  ct existingValue)
     at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(Jso
  nReader reader, Type objectType, Boolean checkAdditionalContent)
     at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type
   objectType)
     at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, Jso
  nSerializerSettings settings)
     at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSeriali
  zerSettings settings)
     at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
  </code></pre>
  
  <p>Steps to reproduce</p>
  
  <pre><code>var test = Newtonsoft.Json.JsonConvert.DeserializeObject&lt;MyStruct&gt;("{FirstText:1,SecondText:2}");
  
  System.Console.WriteLine("{0} - {1}", test.FirstText, test.SecondText);
  </code></pre>
  
  <p>When I use Json.NET in a single exe demo, it works fine.
  But when I take it in a C# Class Library, it does not work.
  I push a issue on github but I still ask there because I am too nervous to wait...</p>