Bug 1079 - MD creates uncompilable project file
Summary: MD creates uncompilable project file
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Project Model ()
Version: unspecified
Hardware: PC Linux
: Normal major
Target Milestone: ---
Assignee: Lluis Sanchez
: 1069 1649 19371 ()
Depends on: 2723
  Show dependency tree
Reported: 2011-09-27 11:25 UTC by Marek Safar
Modified: 2015-07-02 09:29 UTC (History)
10 users (show)

Tags: papercuts
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 Marek Safar 2011-09-27 11:25:53 UTC
1. Create a new C# project and call it test1.0
2. Hit F8/Compile once it finishes
Comment 1 Mikayla Hutchinson [MSFT] 2011-09-27 11:30:11 UTC
What fails?
Comment 2 Marek Safar 2011-09-27 11:31:32 UTC
Compilation fails with

/home/marek/Projects/test4.5/test4.5/Main.cs(0,0): Error CS1001: Unexpected symbol `{', expecting identifier (CS1001) (test4.5)
Comment 3 Mikayla Hutchinson [MSFT] 2011-09-27 11:33:05 UTC
I guess it's not creating a valid class name from the project name.
Comment 4 Marek Safar 2011-09-27 11:34:25 UTC
using System;

namespace test1.
	class MainClass
		public static void Main(string[] args)
			Console.WriteLine("Hello World!");

I have not tested other not allowed C#/VB identifiers
Comment 5 Alan McGovern 2011-09-28 07:13:58 UTC
I'd assume the best solution for this is to add better validation to the project name so instead of blacklisting known bad characters we instead whitelist whitelist all the characters which are valid. We should also disallow reserved names based on language binding as well. This would mean we could prevent people from calling their project 'int' or 'string'.
Comment 6 Alan McGovern 2011-09-28 07:14:49 UTC
*** Bug 1069 has been marked as a duplicate of this bug. ***
Comment 7 Mikayla Hutchinson [MSFT] 2011-09-28 07:38:17 UTC
It's silly to validate project names based on permitted language identifiers. That's just an artifact of limitations in our template system.

What we really need to to validate project names based only on what's valid for MSBuild project names. Then, the template system should derive & escape valid identifiers for the language. We do this already for class names, we just don't handle it for namespaces.

My new template system will fix this.
Comment 8 Marek Safar 2011-10-23 13:15:31 UTC
*** Bug 1649 has been marked as a duplicate of this bug. ***
Comment 10 Mikayla Hutchinson [MSFT] 2014-04-29 20:49:35 UTC
*** Bug 19371 has been marked as a duplicate of this bug. ***
Comment 11 Lluis Sanchez 2015-07-02 09:29:30 UTC
Already fixed.