Bug 17954 - CS0150 not handled correctly
Summary: CS0150 not handled correctly
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: 3.2.x
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2014-02-23 10:41 UTC by Paul Johnson
Modified: 2014-04-30 12:37 UTC (History)
1 user (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 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:

Description Paul Johnson 2014-02-23 10:41:52 UTC
I have a method that gets a translation from a file via a token (it's part of a Xam.iOS & Xam.Android project). The code works fine.

If I use it within a switch, like this

// sort is a string
switch (sort)
case StringUtil.GetString("Common.Farms"):

CS0150 is not thrown on the switch (which it should), but is thrown elsewhere in the code such as

var units = new List<string>(){StringUtils.GetString("Common.Farms"), StringUtils.GetString("Common.Pads")};
Comment 1 Marek Safar 2014-02-24 03:19:45 UTC
I cannot reproduce the issue with Mono 3.2.7. My full test sample

using System;
using System.Collections.Generic;

class X

	public static void Main ()
		string sort = "";
		// sort is a string
		switch (sort) {
		case StringUtils.GetString("Common.Farms"):
			Console.WriteLine ("Hello");

		var units = new List<string> () {StringUtils.GetString ("Common.Farms"),
			StringUtils.GetString ("Common.Pads")


class StringUtils
	public static string GetString (string arg)
		return null;
Comment 2 Marek Safar 2014-04-30 12:37:32 UTC
No response