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 dependency on Assembly.GetCallingAssembly #25494

Closed
wants to merge 1 commit into from

Conversation

steveharter
Copy link
Member

@steveharter steveharter commented May 18, 2022

This PR was used to prep expected changes based on a new breaking change caused by the expected behavior of the JIT inlining a target method due to the new support for IL-Emit'd invokers where IL is used to do the invoke and not native\interpreted logic. This caused Assembly.GetCallingAssembly() to not return the expected assembly, which caused SDK integration tests to fail.

In general, using GetCallingAssembly() is not recommended in general since it doesn't work on all platforms\environments and it is fragile essentially requiring NoInlining attribute.

However, there is now a work-around in place in dotnet/runtime#69575 to avoid that breaking change plus plans to remove that work-around in favor of a better approach to using calli that does not re-introduce the breaking change.

Closing the PR since it is no longer required, although this PR still has merit as mentioned above due to using the fragile GetCallingAssembly(); i.e. if the tests were invoked without reflection they would fail today.

@@ -18,10 +18,9 @@ public abstract class AspNetSdkTest : SdkTest
{
public readonly string DefaultTfm;

protected AspNetSdkTest(ITestOutputHelper log) : base(log)
protected AspNetSdkTest(ITestOutputHelper log, Assembly testAssembly) : base(log)
Copy link
Member

Choose a reason for hiding this comment

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

Can we use GetType() here instead? We do that in some other types in the framework like MemoryStream.

Copy link
Member Author

Choose a reason for hiding this comment

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

Since this class is not concrete, GetType() wouldn't work here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants