Skip to content

Conversation

@dougbu dougbu requested a review from pranavkm March 12, 2018 20:01

// If identifier contains "__", it is "reserved for use by the implementation" and likely compiler-
// or Razor-generated e.g. the name of a field in a delegate's generated class.
if (name.Contains("__"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we need a compat switch to allow this? Seems like a super corner case though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably Razor doesn't stick a CompilerGeneratedAttribute or something along those lines on the member that we could use to infer this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're already dealing with an infrequent case. Imaging a scenario where this fix causes a problem is pretty extreme. I don't think the slight change is worth a compat switch. But, I'll ask around…

Roslyn does apply [CompilerGenerated] to its generated classes but not to fields in those classes. So, that attribute doesn't help distinguish <>c__DisplayClass3_0.collection (which is fine) from <>c__DisplayClass5_1,CS$<>8__locals1 (which isn't). and __ is what docs say. (See the last paragraph in this section of the language spec for example.)

@pranavkm
Copy link
Contributor

:shipit:

@dougbu dougbu merged commit b32ab42 into master Mar 13, 2018
@dougbu
Copy link
Contributor Author

dougbu commented Mar 13, 2018

b32ab42

@dougbu dougbu deleted the dougbu/ignore.compiler.generated.117 branch March 13, 2018 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants