-
Notifications
You must be signed in to change notification settings - Fork 143
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
Newtonsoft.Json.JsonSerializationException: Error getting value from 'ScopeId' on 'System.Net.IPAddress'. #136
Comments
@videege - great question. I think that your custom context looks just fine. At first glance, I though you were serializing identity claims, something that does not always succeeds. The exception sounds a lot like this SO post. I think that the problem may occure when your list of claims have items. For trouble shooting, I would suggest
Report back, and see if you learn anything. It would be helpful if you could attach the json of an message causes this. You could find it my retrieving a message in the management plugin. |
I tried your suggested steps above. Whether or not the list of claims was populated made no difference, I still got a StackOverflowException. I then started trying to serialize just a plain AdvancedMessageContext:
If I don't change the
If I set the
It seems like these Action type properties shouldn't be serialized, or there is some issue with the serialization settings. Is the issue possibly related to how I am registering RawRabbit with the DI system? Using the Sample project, I am doing this:
|
OK, I think I found a lead on the issue. I only encounter this serialization issue when publishing a message in the process of responding to another message, like this:
I think what's happening is I get the first message, the To summarize:
What's the best way to work around this? |
Of course! The problem occurs when trying to forward a message context that contains There is a quick fix for this problem in var advanced = context as IAdvancedMessageContext;
if (advanced != null)
{
advanced.Nack = null;
advanced.RetryLater = null;
} My suggestion is that you implement your own |
I've created a separate issue (#137) to make sure that relevant methods are marked as virtual in 2.0. |
Thanks - I took your suggestion and implemented an |
IPAddress serialization problem: https://stackoverflow.com/questions/18668617/json-net-error-getting-value-from-scopeid-on-system-net-ipaddress pardahlman/RawRabbit#136 Resources.resx comment problem: https://stackoverflow.com/questions/49388573/how-to-get-comment-or-description-field-resx-file-c-sharp
…roblem: IPAddress serialization problem: https://stackoverflow.com/questions/18668617/json-net-error-getting-value-from-scopeid-on-system-net-ipaddress pardahlman/RawRabbit#136 Resources.resx comment problem: https://stackoverflow.com/questions/49388573/how-to-get-comment-or-description-field-resx-file-c-sharp
…roblem: IPAddress serialization problem: https://stackoverflow.com/questions/18668617/json-net-error-getting-value-from-scopeid-on-system-net-ipaddress pardahlman/RawRabbit#136 Resources.resx comment problem: https://stackoverflow.com/questions/49388573/how-to-get-comment-or-description-field-resx-file-c-sharp
…roblem: IPAddress serialization problem: https://stackoverflow.com/questions/18668617/json-net-error-getting-value-from-scopeid-on-system-net-ipaddress pardahlman/RawRabbit#136 Resources.resx comment problem: https://stackoverflow.com/questions/49388573/how-to-get-comment-or-description-field-resx-file-c-sharp
…roblem: IPAddress serialization problem: https://stackoverflow.com/questions/18668617/json-net-error-getting-value-from-scopeid-on-system-net-ipaddress pardahlman/RawRabbit#136 Resources.resx comment problem: https://stackoverflow.com/questions/49388573/how-to-get-comment-or-description-field-resx-file-c-sharp
Hello,
I am using v 1.10.2 of RawRabbit.
I have a custom message context that derives from
AdvancedMessageContext
which stores a list of security claims:I can do Request/Respond operations without error using this custom context, but when I try to do a PublishAsync operation, I get a StackOverflowException. Inspecting this exception made it look like the problem was a reference loop in the object the Json.NET serializer was trying to serialize. It didn't matter what my message was (even a simple one-property class), I was getting a stack overflow. I changed the serializer settings to "ignore" self referencing objects (ReferenceLoopHandling.Ignore) and now I receive the error in the title when the message context is being serialized for publishing:
I'm scratching my head a little bit - do you have any insight on why I'm getting this serialization error?
The text was updated successfully, but these errors were encountered: