Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Reflection.Emit APIs #56153

Merged
merged 10 commits into from
Jul 29, 2021
Merged

Remove Reflection.Emit APIs #56153

merged 10 commits into from
Jul 29, 2021

Conversation

i3arnon
Copy link
Contributor

@i3arnon i3arnon commented Jul 22, 2021

Removes all unused leftover Reflection.Emit APIs

Fix #49452

Removes all unused leftover APIs

Fix dotnet#49452
@krwq krwq requested a review from eerhardt July 22, 2021 14:20
@krwq
Copy link
Member

krwq commented Jul 22, 2021

@i3arnon the only thing which is left is to remove src/libraries/System.Reflection.Emit/src/MatchingRefApiCompatBaseline.txt

@krwq
Copy link
Member

krwq commented Jul 22, 2021

@i3arnon seems you got some build errors:

/__w/1/s/src/coreclr/vm/ceeload.cpp:12445:37: error: out-of-line definition of 'Create' does not match any declaration in 'ReflectionModule'
ReflectionModule *ReflectionModule::Create(Assembly *pAssembly, PEFile *pFile, AllocMemTracker *pamTracker, LPCWSTR szName, BOOL fIsTransient)
                                    ^~~~~~
/__w/1/s/src/coreclr/vm/ceeload.cpp:12472:14: error: no member named 'SetIsTransient' in 'ReflectionModule'
    pModule->SetIsTransient(fIsTransient ? true : false);
    ~~~~~~~  ^
/__w/1/s/src/coreclr/vm/ceeload.cpp:12501:5: error: use of undeclared identifier 'm_fIsTransient'
    m_fIsTransient = false;

@eerhardt
Copy link
Member

What about

  • AssemblyBuilder.DefineDynamicModule(System.String, System.Boolean)
  • ModuleBuilder.DefineDocument(System.String, System.Guid, System.Guid, System.Guid)

I believe those public methods should be deleted as well

@i3arnon
Copy link
Contributor Author

i3arnon commented Jul 22, 2021

What about

  • AssemblyBuilder.DefineDynamicModule(System.String, System.Boolean)
  • ModuleBuilder.DefineDocument(System.String, System.Guid, System.Guid, System.Guid)

I believe those public methods should be deleted as well

Should I just delete the API or follow through all the way? It goes quite deep.
Removing AssemblyBuilder.DefineDynamicModule(System.String, System.Boolean) obviates emitSymbolInfo:

https://github.com/i3arnon/runtime/blob/6351328858949aed8c1ab452bc93339b822d9ba7/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/AssemblyBuilder.cs#L348-L356

And it continues from there.
I'm willing to cut as much as possible :), just want to make sure it's fine..

@eerhardt
Copy link
Member

I think for this PR, let's just remove the public methods. It would definitely go quite deep to start removing the unused emitSymbolInfo parameter. I think that refactoring can be done in a follow up PR.

@i3arnon
Copy link
Contributor Author

i3arnon commented Jul 22, 2021

The test failures don't seem to be related.
Could they be transient? Is it possible to rerun them?

@stephentoub stephentoub added community-contribution Indicates that the PR has been added by a community member and removed community-pr labels Jul 22, 2021
@jeffhandley
Copy link
Member

I've kicked off a re-run of the failed jobs.

@krwq This PR is assigned to you for follow-up before the RC1 snap.

@krwq
Copy link
Member

krwq commented Jul 28, 2021

@i3arnon this looks good to me, are you planning to also remove System.Reflection.Emit.ModuleBuilder.GetModuleHandleImpl? Seems that's the only extra API now. Consider changing it to just internal if implementation is used in many places

@eerhardt
Copy link
Member

are you planning to also remove System.Reflection.Emit.ModuleBuilder.GetModuleHandleImpl? Seems that's the only extra API now. Consider changing it to just internal if implementation is used in many places

I don't believe we should change this. See the code comment for an explanation.

fyi @MichalStrehovsky since this references CoreRT.

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @i3arnon for the contribution!

@krwq krwq merged commit 742ea07 into dotnet:main Jul 29, 2021
@i3arnon i3arnon deleted the old-reflection-apis branch July 29, 2021 11:16
@i3arnon
Copy link
Contributor Author

i3arnon commented Jul 29, 2021

I think for this PR, let's just remove the public methods. It would definitely go quite deep to start removing the unused emitSymbolInfo parameter. I think that refactoring can be done in a follow up PR.

Now that this is merge.. should I do that follow up PR?

@krwq
Copy link
Member

krwq commented Jul 29, 2021

@i3arnon yes please, if don't have time please create an issue

i3arnon added a commit to i3arnon/runtime that referenced this pull request Aug 1, 2021
@MichalStrehovsky
Copy link
Member

fyi @MichalStrehovsky since this references CoreRT.

Yeah, the reflection stack in NativeAOT is not implemented in CoreLib so keeping this protected internal allows the NativeAOT reflection stack to override. If we undo that here, we'll need to undo that change in NativeAOT again. Appreciate that we don't have to :).

lambdageek pushed a commit that referenced this pull request Aug 9, 2021
* Remove unused System.Reflection.Emit leftovers

Follow up to #56153

* Remove nCreateISymWriterForDynamicModule

* Removes LineNumberInfo, MarkSequencePoint & GetMethodSigHelper

* Remove MarkSequencePoint from mono

* Fix GetMethodSigHelper overloads

* Match changes in mono

* Remove SequencePointList from mono
@ghost ghost locked as resolved and limited conversation to collaborators Sep 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Reflection.Emit community-contribution Indicates that the PR has been added by a community member
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Add back Reflection.Emit APIs from .NET Framework
6 participants