Bug 48514 - Crash in Java.Lang.String.Format when supplying array of arguments
Summary: Crash in Java.Lang.String.Format when supplying array of arguments
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2016-12-01 11:09 UTC by Alek Slater
Modified: 2017-06-28 01:25 UTC (History)
2 users (show)

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

Sample Solution (33.13 KB, application/zip)
2016-12-01 11:09 UTC, Alek Slater

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 for Bug 48514 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Alek Slater 2016-12-01 11:09:44 UTC
Created attachment 18736 [details]
Sample Solution

Java.Lang.String.Format does not work correctly or crashes when given an array of string arguments instead of doing it using the variadic method.

So in other words: 
Java.Lang.String.Format("Greetings %1$s",new string[]{"Bob"}); // doesnt work correctly
Java.Lang.String.Format("Greetings %1$s, hows the %2$s?",new string[]{"Bob","Weather"}); // Crashes.

Java.Lang.String.Format("Greetings %1$s","Bob"); // Works ok
Java.Lang.String.Format("Greetings %1$s, hows the %2$s?","Bob","Weather"); // Works ok

I've attached a solution that reproduces the issues.