Bug 17658 - AndroidResgen does not encode (certain?) reserved f# keywords
Summary: AndroidResgen does not encode (certain?) reserved f# keywords
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 4.10.2
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Atsushi Eno
Depends on:
Reported: 2014-02-07 13:39 UTC by Chris H
Modified: 2014-08-23 04:13 UTC (History)
3 users (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 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 Chris H 2014-02-07 13:39:59 UTC
The AndroidResgen for f# does not encode f# keywords with `` ``

Currently when you add the component 'Android Support Library v7 AppCompat' it adds the resource 'end' which causes a compilation error in the generated code.

outputted code in Resource.designer.fs

  // aapt resource value: 0x7f050013
  static member end = 2131034131

should be encoded for keywords

  // aapt resource value: 0x7f050013
  static member ``end`` = 2131034131

I noticed the f# code dom does support encoding so I am not sure why it is not working in this case.

Comment 1 Atsushi Eno 2014-04-30 03:56:13 UTC
I have internally updated F# CodeDom implementation to the code in fsharpbinding, but I still don't see "end" being escaped.

Dave: do you know if F# codedom really supports escaping symbols in every use (namely for XA use). It is simple CodeAssignStatement from CodeFieldReferenceExpression and CodeFieldReferenceExpression.
Comment 2 Dave Thomas 2014-04-30 07:49:00 UTC
end is an escaped keyword, Maybe this particular instance is not yet catered for.
Comment 3 Dave Thomas 2014-04-30 08:35:21 UTC
The IsValidIdentifier and MakeEscapedIdentifiers are plugged into the CodeDom model from an interface point of view.  The internal generation will need a little tweak though, I think I see where roughly.
Comment 4 Dave Thomas 2014-04-30 10:45:30 UTC
This is fixed in fsharpbinding/vnext and master.  Im not sure how you are referencing the CodeDom code.
Comment 5 Atsushi Eno 2014-04-30 17:36:27 UTC
Applied the fix to our source tree and now it builds with monodroid master. Thanks.

[master 44c567c]
Comment 6 Atsushi Eno 2014-06-10 00:07:26 UTC
The new CodeDom was regressive as described at bug #20122. Reverted.
Comment 7 Atsushi Eno 2014-08-21 02:34:45 UTC
This cannot be fixed unless F# project itself gets non-regressive version of CodeDom implementation.
Comment 8 Dave Thomas 2014-08-21 05:42:48 UTC
Once there are unit tests this can be done.
Comment 9 Atsushi Eno 2014-08-21 19:03:13 UTC
It is not about missing test. It is about regressive CodeDom implementation.
Comment 10 Dave Thomas 2014-08-23 04:13:52 UTC
Without any standard tests its difficult to progress anything.  I don't know anything about the Android code generation at all, so I simply cant verify anything in this area.