Bug 16979 - StringBuilder.AppendFormat != string.Format
Summary: StringBuilder.AppendFormat != string.Format
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Class Libraries
Classification: Mono
Component: General ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2013-12-28 21:03 UTC by alex
Modified: 2014-01-01 09:35 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_REPRODUCIBLE

Description alex 2013-12-28 21:03:10 UTC
var sb = new StringBuilder();

// This fails:
sb.AppendFormat ("<span color=\"#{0:x2}{1:x2}{2:x2}\">", 123, 1, 16);

// This works:
sb.Append(string.Format("<span color=\"#{0:x2}{1:x2}{2:x2}\">", 123, 1, 16));



Exception:
Null-ref exception
  at System.String.FormatHelper (System.Text.StringBuilder result, IFormatProvider provider, System.String format, System.Object[] args) [0x00000] in <filename unknown>:0 
  at System.Text.StringBuilder.AppendFormat (IFormatProvider provider, System.String format, System.Object[] args) [0x00000] in <filename unknown>:0 
  at System.Text.StringBuilder.AppendFormat (System.String format, System.Object arg0, System.Object arg1, System.Object arg2) [0x00000] in <filename unknown>:0 
  at MonoDevelop.D.Gui.DToolTipProvider.DCodeToMarkup (Mono.TextEditor.Highlighting.ColorScheme st, System.String code) [0x000f3] in /home/lx/Dokumente/Projects/Mono-D/MonoDevelop.DBinding/Gui/DToolTipProvider.cs:170 
  at MonoDevelop.D.Gui.DToolTipProvider.CreateTooltip (Mono.TextEditor.TextEditor editor, D_Parser.Resolver.AbstractType t, Int32 offset, ModifierType modifierState) [0x00021] in /home/lx/Dokumente/Projects/Mono-D/MonoDevelop.DBinding/Gui/DToolTipProvider.cs:136 
  at MonoDevelop.D.Gui.DToolTipProvider.CreateTooltipWindow (Mono.TextEditor.TextEditor editor, Int32 offset, ModifierType modifierState, Mono.TextEditor.TooltipItem item) [0x00063] in /home/lx/Dokumente/Projects/Mono-D/MonoDevelop.DBinding/Gui/DToolTipProvider.cs:68 
  at MonoDevelop.D.Gui.DToolTipProvider.ShowTooltipWindow (Mono.TextEditor.TextEditor editor, Int32 offset, ModifierType modifierState, Int32 mouseX, Int32 mouseY, Mono.TextEditor.TooltipItem item) [0x0002b] in /home/lx/Dokumente/Projects/Mono-D/MonoDevelop.DBinding/Gui/DToolTipProvider.cs:90 
  at Mono.TextEditor.TextArea.TooltipTimer () [0x00185] in /run/media/lx/Home.alt/lx/Dokumente/Projects/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextArea.cs:2750
Comment 1 Marek Safar 2014-01-01 09:35:57 UTC
Works for me with Mono 3.2.5