-
Notifications
You must be signed in to change notification settings - Fork 62
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
Data validation / Error detection strategies #153
Comments
I’ll have to look at it but that doesn’t sound quite right to me. I’m also in the midst of rewriting a section of the library that may address this. What is the underlying type of the field that you’re constraining? |
Just a recent example of this that I've seen:
|
As a workaround, you can follow a fail-fast system with MemberSerialized/MemberDeserialized events on your BinarySerializer where you can check each field as it is serialized/deserialized and throw when it is invalid by your checks. EDIT: Realized BinarySerializer swallows exceptions sometimes. Instead, a workaround can have you collect exceptions in a List at MemberSerialized/MemberDeserialized then check if that list count is not 0 later on and throw as a AggregateException. Its not pretty but a good workaround for right now. |
Hello,
Are there any existing strategies to detect parsing/deserialize errors and to catch at least the most obvious parsing errors?
For example, if I'm specifying that the FieldLength should be 4, but only 1 byte is available, that 1 byte is used and no error is thrown.
Is there an easy way to add custom validation on field-by-field basis (i.e. if you know a range that the valid value should be in)?
Thank you
The text was updated successfully, but these errors were encountered: