https://bugzilla.novell.com/show_bug.cgi?id=402442
Summary: Any Xml.Linq new XNode call with parameters will fail on
the first text parameter
Product: Mono: Class Libraries
Version: 1.9.0
Platform: All
OS/Version: Other
Status: NEW
Severity: Major
Priority: P5 - None
Component: Sys.XML
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]
QAContact: [email protected]
Found By: Other
If you do new Xelement("Foo", "Bar") it will fail because ShrinkArray tries to
append each string to a null pointer. The work around is
new Xelement("Foo") {Value="Bar"}
but that's not obvious and doesn't address the more general cases
The fix is simple -- test prev for null and assign rather than append as in
prev = prev == null ? o : prev + o
public static IEnumerable<object> ShrinkArray (params object [] content) {
if (content == null || content.Length == 0)
yield break;
string prev = null;
foreach (object o in content) {
if (o is XNode) {
if (prev != null) {
yield return prev;
prev = null;
}
yield return o;
} else {
prev += o;
}
}
if (prev != null)
yield return prev;
}
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
_______________________________________________
mono-bugs maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs