-
Notifications
You must be signed in to change notification settings - Fork 78
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
Submit of report with CustomInfo fails #69
Comments
Actually this: var serializer = this.CustomInfo != null
? new XmlSerializer(typeof(Report), new[] { this.CustomInfo.GetType() })
: new XmlSerializer(typeof(Report)); can just be this: var serializer = new XmlSerializer(typeof(Report), new[] { this.CustomInfo.GetType() }); since specifying extra type does not break the serialization/deserialization when that type does not appear in the data. I don't have a Windows env. to test this idea but if you can, make a PR and I'll merge it. Thanks for the report also. |
Yes, you are right but the problem here is: |
Yeah, specifying only the base type Anyway, good luck. Stackoverflow might have some ideas on this. |
@soygul - I get this error with your change:
Report.cs:line 52 is:
|
Known issue. Don't use custom info until someone fixes it. I don't use Windows any more so can't work on it. |
Hi!
When creating a bug report with CustomInfo object set, NBug throws an exception when trying to submit this report. This problem was mentioned earlier here on StackOverflow.
In Report.cs the report class gets serialized in the ToString Methodwith this code:
var serializer = this.CustomInfo != null
? new XmlSerializer(typeof(Report), new[] { this.CustomInfo.GetType() })
: new XmlSerializer(typeof(Report));
so if setting
CustomInfo != null
the XmlSerializer constructor with the "extraTypes" parameter gets called. See MSDN.After restarting the application, NBug tries to submit the bug report, this leads to Dispatcher.cs method
GetDataFromZip(Stream stream)
the deserialization of the report file happens always with the following call:var deserializer = new XmlSerializer(typeof(Report));
Unfortunately this leads to a wrongly deserialized Xml so the CustomInfo member of the Report class gets deserialized to a
XmlNode[]
which in turn cannot be correctly serialized later when submitting the bugreport.Kind regards,
Andy
The text was updated successfully, but these errors were encountered: