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

Fix Self referencing loop detected for property #875

Merged
merged 1 commit into from
Jan 23, 2023

Conversation

eseneckiy
Copy link
Contributor

Fix Self referencing loop detected for property 'Parent'

Newtonsoft.Json.JsonSerializationException : Self referencing loop detected for property 'Parent' with type 'System.Globalization.CultureInfo'. Path 'Culture'. StackTrace: 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.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, 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.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, 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.JsonSerializer.Serialize(JsonWriter jsonWriter, Object value, Type objectType) at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer) at WireMock.Server.WireMockServer..ctor(WireMockServerSettings settings) at WireMock.Server.WireMockServer.Start(WireMockServerSettings settings)

@StefH
Copy link
Collaborator

StefH commented Jan 19, 2023

@eseneckiy
Can you show example code / unit test when this happens?

@eseneckiy
Copy link
Contributor Author

@eseneckiy Can you show example code / unit test when this happens?

Hi @StefH
Can't reproduce it on my local machine.
This exception is throws only on our CI pipeline for WireMock.Net 1.5.13. Changing version to 1.5.12 fixed this problem.
I'll try to find out the root cause.

@StefH
Copy link
Collaborator

StefH commented Jan 22, 2023

@eseneckiy
The only way this can occur if you serialize the setting yourself somewhere in the pipeline or in your unit test project.

@eseneckiy
Copy link
Contributor Author

eseneckiy commented Jan 23, 2023

Serialization is used for log purposes. In WireMockServer constructor settings is serialized for debug log.

protected WireMockServer(WireMockServerSettings settings)

// . . .

_settings.Logger.Debug("Server settings {0}", JsonConvert.SerializeObject(settings, Formatting.Indented));`

@StefH StefH merged commit b4c8779 into WireMock-Net:master Jan 23, 2023
@StefH StefH added the bug label Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants