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 assert in PEFile::GetAssemblyLoadContext #38212

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/coreclr/src/vm/pefile.h
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,13 @@ class PEFile

#endif //!DACCESS_COMPILE

// Returns AssemblyLoadContext into which the current PEFile was loaded.
// It returns NULL for System.Private.CoreLib during early runtime initialization
// stage when the related AssemblyLoadContext does not exist yet.
PTR_AssemblyLoadContext GetAssemblyLoadContext()
{
LIMITED_METHOD_CONTRACT;

_ASSERTE(m_pAssemblyLoadContext != NULL);
Copy link
Member

@jkotas jkotas Jun 22, 2020

Choose a reason for hiding this comment

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

I think this assert is good and it should stay.

Would it be possible to call AppDomain::GetCurrentDomain()->CreateBinderContext() instead of AppDomain::GetCurrentDomain()->GetTPABinderContext() in SetupAssemblyLoadContext; and also delete the null checked for GetAssemblyLoadContext returning NULL from AcquireCompositeImage ?

Copy link
Member Author

Choose a reason for hiding this comment

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

That could work, I'll give it a try.

return m_pAssemblyLoadContext;
}

Expand Down