Bug 2456 - Resources do not get created when a user name contains @ character.
Summary: Resources do not get created when a user name contains @ character.
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 4.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2011-12-11 09:08 UTC by Chris Hardy [MSFT]
Modified: 2012-11-20 14:21 UTC (History)
3 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 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:
Status:
RESOLVED FIXED

Description Chris Hardy [MSFT] 2011-12-11 09:08:52 UTC
1. Create a new Windows user account that contains "@" such as "N@t".
2. Install Mono for Android.
3. Try to compile application and get error

Error CS0103: The name 'Resource' does not exist in the current context (CS0103) 

and the Resource.Designer.cs file is empty bar the namespace.

Previous to 4.0, the error looked like the follow;

C:\Program Files\MSBuild\Novell\Novell.MonoDroid.Common.targets(2,2): Error MSB4018: The "GenerateResourceDesigner" task failed unexpectedly.

System.IO.FileNotFoundException: Could not find file 'C:\Users\m@l@k\AppData\Local\Temp\ikmkclxv.g1f\R.java'.

File name: 'C:\Users\m@l@k\AppData\Local\Temp\ikmkclxv.g1f\R.java'

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)

at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)

at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)

at System.IO.StreamReader..ctor(String path)

at System.IO.File.OpenText(String path)

at Xamarin.Android.Tasks.JavaResourceParser.Parse(String file, Dictionary`2 resourceMap)

at Xamarin.Android.Tasks.GenerateResourceDesigner.Execute()

at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult) (MSB4018) (Andy)
Comment 1 Jonathan Pobst 2011-12-12 17:59:51 UTC
My guess is if you turn on verbose logging, you will find an error earlier where the error is that aapt.exe errors out.  If so, I don't know if we'll be able to coerce Google's aapt.exe to accept a path with a @ in it.
Comment 3 dean.ellis 2012-11-15 11:36:36 UTC
Chris, does this have to be a user? or is it just a file path with an @ in it? 
i've tried the latter and it works without any problems. 

Do we know which version of Windows the issue was reported on? I've tried on Windows 7.
Comment 5 dean.ellis 2012-11-20 14:21:28 UTC
Fixed in master/ebedf0a505

This turned out to be an issue with the way Visual Studio creates
projects if the user name contains a @ character. Rather than
creating correct relative paths for files such as

Resources\Values\Strings.xml

It creates paths like

..\..\..\n@n\Documents\Visual Studio 2010\Projects\Test\Resources\Values\Strings.xml

This in turn caused the Resources to be copied into a directory which is not obj/$(Configuration)/res which results in them not being included in the build.

The fix is to expand the resource path to be the full path and then
turn it back into the expected local relative path using the Project
Directory value from MSBuild.