Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed OmniSharp hanging on nuget references with wildcard #1473

Merged
merged 3 commits into from
Apr 18, 2019

Conversation

filipw
Copy link
Member

@filipw filipw commented Apr 18, 2019

fixes dotnet/vscode-csharp#3009
fixes dotnet/vscode-csharp#2993
fixes dotnet/vscode-csharp#2997
fixes dotnet/vscode-csharp#2996

In Nuget packages 5.x.x to which we recently moved, range types with wildcards are no longer JSON serializable, and we attempted to dump them do JSON.... to put them in a debug message.

That debug message caused a null reference exception, which caused OmniSharp to hang since initial code check operation would never complete.

      at NuGet.Versioning.FloatRange.Equals(FloatRange other)
   at System.Collections.Generic.ObjectEqualityComparer`1.Equals(T x, T y)
   at System.Collections.Generic.List`1.Contains(T item)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CheckForCircularReference(JsonWriter writer, Object value, JsonProperty property, JsonContract contract, JsonContainerContract containerContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
   at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
   at Newtonsoft.Json.Linq.JToken.FromObjectInternal(Object o, JsonSerializer jsonSerializer)
   at Newtonsoft.Json.Linq.JObject.FromObject(Object o, JsonSerializer jsonSerializer)
   at OmniSharp.MSBuild.ProjectManager.AddProject(ProjectFileInfo projectFileInfo) in C:\code\omnisharp-roslyn\src\OmniSharp.MSBuild\ProjectManager.cs:line 359
   at OmniSharp.MSBuild.ProjectManager.ProcessQueue(CancellationToken cancellationToken) in C:\code\omnisharp-roslyn\src\OmniSharp.MSBuild\ProjectManager.cs:line 250

Copy link

@rchande rchande left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, nice.

@filipw
Copy link
Member Author

filipw commented Apr 18, 2019

thanks guys.

I also just added a test to guard us against this for the future - it passes on this branch, but it fails against master where the nasty JSON line is still present.
Hopefully should be good to merge now!

@bjorkstromm bjorkstromm merged commit 77a01df into OmniSharp:master Apr 18, 2019
@bjorkstromm
Copy link
Member

Thanks @filipw!

@filipw filipw deleted the bugfix/nuget-hang branch April 19, 2019 05:25
@imba-tjd
Copy link

._ProjectWithWildcardPackageReference.csproj: Binary file not shown.

Is this by designed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants