System.OutOfMemoryException when merging Newtonsoft.Json

I am creating a plugin to call a webservice. I need to serialize and deserialize the Json object. So, I need Newtonsoft.Json. I am trying to merge the dll from NewtonSoft.Json and my application dll using ILMerge.MSBuild.Task and ILMerge in Visual Studio 2015.

I get the error below:

I looked for solution in internet but could not find any solution.

For ILMerge in VisualStudio Use the necessary dlls from NuGet Package Manager Only

I was using the MSBuild.ILMerge.Task 1.0.5 and latest verson of Newtonsoft.Json and getting this type of issue.

I tried with to stable version by downgrade to Newtonsoft.Json version 10.0.3 and it works well.

Hope this helps!!!

OutOfMemoryException error when merging NodaTime · Issue #29 , When I try to use ILMerge to merge a C# DLL that uses NodaTime, I get the following Task.targets(87,5): error : Exception of type 'System. I'm doing a process where my server generates a file with JSON.Net with 25000 records and size of 85MB, then this file is imported by client. The client downloads the file and makes the deserializ

If you're using ILMerge only to serialize/deserialize JSON I'd recommend to drop it and use the DataContractJsonSerializer class instead. This change would remove the dependency with Newtonsoft.Json and ILMerge (not supported) to end up with a lighter plugin library (which is always good):

// Deserialize a JSON stream to a User object.  
public static User ReadToObject(string json)  
    User deserializedUser = new User();  
    MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(json));  
    DataContractJsonSerializer ser = new DataContractJsonSerializer(deserializedUser.GetType());  
    deserializedUser = ser.ReadObject(ms) as User;  
    return deserializedUser;  

Full example can be found here.

Out of memory exception · Issue #2015 · JamesNK/Newtonsoft.Json , if i exceed 200 Mb i get an Out of Memory Exception. T)(path As String, Optional ByVal settings as JsonSerializerSettings = Nothing) As T Using reader As New System.IO.StreamReader(path) Using jsonReader as New Newtonsoft.​Json. Successfully merging a pull request may close this issue. Hi all, I have a problem deserializing a JSON file of about 1GB. When I run the following code I get an out of memory exception: using (FileStream sr = new FileStream("myFile.json", FileMode.Open, FileAccess.Read)) { using (StreamReader

I was able to fix this issue by taking the latest dll from nuget, & just putting it into side folder & reference the dll direct.

Im not sure why nuget messes it up, but after i took nuget out of the picture the the build worked.

I don't like the fact that i cant use nuget for getting updates for this project, but as least it workes.

Debugging System.OutOfMemoryException using .NET tools, If you're interested in more details about this subject, I recommend this article from Eric Lippert, a former Microsoft employee working on the C#  I am getting out of memory exception while serializing large data using NewtonSoft json serializer. Below is the exception i am getting:-System.OutOfMemoryException: OutOfMemoryException at System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity)

OutOfMemoryException error when merging AWSSDK.S3.dll, Ask questionsOutOfMemoryException error when merging AWSSDK.S3.dll. I am trying Now when I use ILMerge I get the follow Exception of type 'System. C:\​FTG\MHNetCRM2016.root\Code\ActivityLib2011\bin\Debug\Newtonsoft.Json.dll​  I looked into it and believe that the PDB file in NodaTime's net45 directory is the new portable PDB format. At least, it's format as seen in ILMerge looks to be the same as the one in NodaTime's netstandard1.3 directory.

Exception of type 'System.OutOfMemoryException' was thrown WEB , The error is Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON object var db = DependencyService.Get<ISQLiteDB>(); var conn  String json = JsonConvert.SerializeObject(json, Newtonsoft.Json.Formatting.Indented); what am i missing ? MORE INFO: - This was working fine till i was using dynamic , i had to switch to MultiDictionary to allow multiple properties of the same name . It works for most cases , only when the number of items is large , it breaks . UPDATE: -

Newtonsoft Json OutOfMemoryException, First of all, some introduction on how to serialize any object into JSON: whether you use StackOverflowException: 'Exception of type 'System. This sample merges LINQ to JSON objects. Json.NET Documentation. Json.NET Documentation. Samples. LINQ to JSON. Create JSON manually. Merging JSON This sample

  • Add /ndebug:true help me…