Bug 28734 - String.Format throws a stackoverflow exception if format string contains a missing parameter
Summary: String.Format throws a stackoverflow exception if format string contains a mi...
Alias: None
Product: iOS
Classification: Xamarin
Component: BCL Class Libraries ()
Version: XI 8.10
Hardware: PC Windows
: Normal normal
Target Milestone: Untriaged
Assignee: Rodrigo Kumpera
Depends on:
Reported: 2015-04-03 10:39 UTC by softlion
Modified: 2015-08-17 11:13 UTC (History)
5 users (show)

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 Developer Community or GitHub 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:

Description softlion 2015-04-03 10:39:00 UTC

String.Format("{1}", null);


critical: Stack overflow in unmanaged: IP: 0x1f4abc, fault addr: 0xb064ffec
critical: Stack overflow in unmanaged: IP: 0x8efbdcc, fault addr: 0xb064ec2c
	System.NullReferenceException: Object reference not set to an instance of an object
	  at System.Threading.Tasks.TaskExceptionHolder..ctor (System.Threading.Tasks.Task task) [0x00006] in /Users/builder/data/lanes/macios-mac-macios-cycle5/4dac6bff/source/mono/external/referencesource/mscorlib/system/threading/Tasks/TaskExceptionHolder.cs:64 

It should generate a more explicit exception instead.
Comment 1 Sebastien Pouliot 2015-04-03 11:46:04 UTC
> String.Format("{1}", null);

This ^ alone works fine, i.e. it gives me the exception I expected, i.e.

System.ArgumentNullException : Argument cannot be null.
Parameter name: args
 		  at System.String.FormatHelper (System.Text.StringBuilder result, IFormatProvider provider, System.String format, System.Object[] args) [0x00017] in /Users/poupou/git/xamarin/mono/mcs/class/corlib/System/String.cs:1960 
 		  at System.String.Format (IFormatProvider provider, System.String format, System.Object[] args) [0x00000] in /Users/poupou/git/xamarin/mono/mcs/class/corlib/System/String.cs:1951 
 		  at System.String.Format (System.String format, System.Object[] args) [0x00000] in /Users/poupou/git/xamarin/mono/mcs/class/corlib/System/String.cs:1946 

However your stack trace makes it seems to be contextual to where the exception occurred (in a task) and the original exception could not be reported back (without the stack overflow).

That seems to be a mono issue (with the new MS reference code added in mono  4.0). -> Rodrigo for assignment
Comment 2 Rodrigo Kumpera 2015-04-03 11:54:26 UTC
Please provide a reproducible test case
Comment 3 Sebastien Pouliot 2015-05-28 13:16:58 UTC
@Benjamin, this is not something we have seen since your report. Are you still able to duplicate this ? if so can you give us a test case ? thanks!
Comment 4 Marek Safar 2015-08-17 10:39:38 UTC
No response, closing
Comment 5 softlion 2015-08-17 11:13:37 UTC
I don't know, i did not make the error of forgetting a parameter since a long time. But you can easily repro and try by yourself.