You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use Orleans since one of one of the earliest alphas for 2.0 with .NET Core and I think that I never had a problem with exceptions, although I am not sure.
Recently we discovered a bug where validation details where not displayed correctly in the UI. It does not happen very often because there is also a lot of client side validation. Validation errors are transported with a custom validation exception, something like:
[Serializable]
class ValidationException : Exception
{
LIst<ValidationError> Details;
}
The documentation is out-of-date. That's my fault.
ILBasedSerializer was developed as an option for .NET Core when BinaryFormatterSerializer was not going to be enabled, but before we flicked the switch on Orleans 2.0, we changed the default to make it BinaryFormatterSerializer on all platforms (primarily to keep as much compatibility as possible).
I've considered whether it would be worth removing ILBasedSerializer. There's no real benefit to removing it now, but if we revise the internal serializer architecture in future (which is likely) then it might not be worth bringing ILBasedSerializer along for the ride immediately (or at all, we'll see).
So, to your question: what do you do when you want a custom exception to be serializable? The answer is that you should implement ISerializable. That means adding a serialization constructor and implementing GetObjectData. See here as an example:
Hi,
I use Orleans since one of one of the earliest alphas for 2.0 with .NET Core and I think that I never had a problem with exceptions, although I am not sure.
Recently we discovered a bug where validation details where not displayed correctly in the UI. It does not happen very often because there is also a lot of client side validation. Validation errors are transported with a custom validation exception, something like:
Details was always Empty and the reason was that our serialization logic was not correct. So we fixed it: https://github.com/Squidex/squidex/blob/master/src/Squidex.Infrastructure/ValidationException.cs#L53
The docu says:
But obviously it cannot be correct for exceptions and I am not sure if this behavior has been changed recently.
Futhermore the documentation says nothing about exceptions and serialization.
Some clarification would be great.
The text was updated successfully, but these errors were encountered: