Bug 19328 - Weird string.Format behavior if format token size goes past 33 elements.
Summary: Weird string.Format behavior if format token size goes past 33 elements.
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: 2.10.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-04-28 02:13 UTC by JohanO
Modified: 2014-04-28 07:20 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 JohanO 2014-04-28 02:13:06 UTC
Hi Guys... I had an issue that I simply can only explain as freakin weird. I was building up a SQL string like the following example...

-------

float[] val = new float[37];
/* Populate with random values, in my code they are "obj.prop" values but I think this will have the same effect and yes I realize I could have just passed a reference to the array casted to object... */

return string.Format(
			@"INSERT INTO SomeTable (NoNeedToBeAccurateSql) 
			VALUES ({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{22},{23},{24},{25},{26},{27},{28},{29},{30},{31},{32},{33},{34},{35},{36})",

	               val[0]		
                       val[1], 
			val[2], 
			val[3], 
			val[4], 
			val[5], 
			val[6], 
			val[7], 
			val[8], 
			val[9],
			val[10],
			val[11], 
			val[12], 
			val[13], 
			val[14],
			val[15], 
			val[16], 
			val[17], 
			val[18], 
			val[19], 
			val[20], 
			val[21], 
			val[22], 
			val[23], 
			val[24], 
			val[25], 
			val[26], 
			val[27], 
			val[28], 
			val[29], 
			val[30], 
			val[31],
			val[32], 
			val[33], 
			val[34], 
			val[35], 
			val[36]);

---------------------
I noticed that everything past the {33} element was not making any sense?? So I split it up into two string.Formats that I concatenate to solve it. I went through my code 100 times to make sure there's nothing that I do that would effect the scramble. Explain this to me?
Comment 1 Marek Safar 2014-04-28 07:20:52 UTC
I cannot reproduce this behaviour with Mono 3.4

I get expected

NSERT INTO SomeTable (NoNeedToBeAccurateSql) 
            VALUES
(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)