Skip to content

Do not require an assembly-level ExtensionAttribute...#2506

Merged
gafter merged 1 commit intodotnet:masterfrom
gafter:fix365
May 5, 2015
Merged

Do not require an assembly-level ExtensionAttribute...#2506
gafter merged 1 commit intodotnet:masterfrom
gafter:fix365

Conversation

@gafter
Copy link
Member

@gafter gafter commented May 5, 2015

in order for the C# compiler to recognize extension methods
contained within the assembly. In other words, we assume every
PE assembly may contain extension methods.
Fixes #365

What we want to do with this PR depends on performance run results that we should have by tomorrow morning.
/cc @jaredpar @VSadov @pharring

@gafter gafter added Area-Compilers Tenet-Compatibility Violation of forwards/backwards compatibility in a design-time piece. labels May 5, 2015
@gafter gafter added this to the 1.0 (stable) milestone May 5, 2015
@gafter gafter self-assigned this May 5, 2015
@gafter
Copy link
Member Author

gafter commented May 5, 2015

/cc @theoy @MattGertz

@VSadov
Copy link
Member

VSadov commented May 5, 2015

I guess it is the easiest way to know for sure.

@VSadov
Copy link
Member

VSadov commented May 5, 2015

LGTM

Copy link
Contributor

Choose a reason for hiding this comment

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

typo: properly

@gafter
Copy link
Member Author

gafter commented May 5, 2015

The performance numbers so far look good - no noticeable regression in performance at all. We'll have more soon.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also remove these helper methods (at least the "HasFSharpInterfaceDataVersionAttribute" one...assuming it's not used elsewhere)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes... done.

@KevinH-MS
Copy link
Contributor

👍

1 similar comment
@jaredpar
Copy link
Member

jaredpar commented May 5, 2015

👍

in order for the C# compiler to recognize extension methods
contained within the assembly. In other words, we assume every
PE assembly may contain extension methods.
Fixes dotnet#365
@gafter
Copy link
Member Author

gafter commented May 5, 2015

Batch compiler performance tests reveal no regression. Running IDE and typing performance tests now...

@pharring
Copy link
Contributor

pharring commented May 5, 2015

IDE tests look good too.
From a performance point of view, this change has negligible impact.

gafter added a commit that referenced this pull request May 5, 2015
Do not require an assembly-level ExtensionAttribute...
@gafter gafter merged commit 37bd384 into dotnet:master May 5, 2015
@davkean
Copy link
Member

davkean commented May 6, 2015

Do you have tests that test a large set of reference assemblies, such as Store, Phone, UAP, or portable?

@tmat
Copy link
Member

tmat commented May 6, 2015

Also some 30MB assembly produced by C++/CLI would be good to include in such testing

@pharring
Copy link
Contributor

pharring commented May 6, 2015

@davkean We have large sets, but all our perf tests are desktop solutions. Why do you think other target frameworks would be significant?

@tmat why? The perf concern is that we now have to check all assemblies, so a C++/CLI assembly with hand-written extension methods would be treated just the same as a VB or C# one.

@davkean
Copy link
Member

davkean commented May 6, 2015

@pharring Because, unlike desktop which typically only references small amounts of assemblies from the framework (only the ones the templates or user has chosen), the rest of the project types automatically reference 60 - 100 assemblies by default.

@davkean
Copy link
Member

davkean commented May 6, 2015

@pharring Should clarify, what I mean is that it doesn't matter if it's desktop or something else, as long as something with a significant amount of referenced assemblies is represented.

@tmat
Copy link
Member

tmat commented May 6, 2015

@pharring
If an assembly reference doesn't have an extension attribute on its AssemblyDef wouldn't we now need to check all its methods for the attribute to determine that there are no public extension methods declared in it?

@pharring
Copy link
Contributor

pharring commented May 6, 2015

@tmat Yes, exactly. That's why this is a performance concern for all compilations. It doesn't matter whether the referenced assembly is written in C#, C++/CLI or Martian.

@davkean I understand. We don't have such automated tests today. We can do manual testing for it. Do you think that building the portable pieces of Roslyn itself would be a good enough test?

@gafter
Copy link
Member Author

gafter commented May 6, 2015

@tmat Not exactly. We now have to check all types in the assembly. We still require the containing type to be attributed.

@davkean
Copy link
Member

davkean commented May 6, 2015

@pharring Yes, assuming that you are opt'ing into the default behavior of portable (<ImplicitlyExpandTargetFramework>true</ImplicitlyExpandTargetFramework>), and not building against packages representing the framework.

Update: Editor ate my XML tags.

@tmat
Copy link
Member

tmat commented May 6, 2015

@gafter @Pharing OK, so we check all types. The reason why I'm mentioning C++ is that managed C++ may generate enormous assemblies with a lot of types, unlike C# and VB.

@gafter
Copy link
Member Author

gafter commented Jun 16, 2015

@AlekseyTs FYI

@gafter gafter deleted the fix365 branch November 5, 2015 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Compilers cla-already-signed Tenet-Compatibility Violation of forwards/backwards compatibility in a design-time piece.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Roslyn C# compiler doesn't recognize extension methods from most libraries written in C++/CLI and other CLI languages

8 participants