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

Fix NRE when default value is null and ServiceCallSite is not found #44877

Merged
merged 5 commits into from
Nov 25, 2020

Conversation

maryamariyan
Copy link
Member

@maryamariyan maryamariyan commented Nov 18, 2020

Backport of #44675 to release/5.0

/cc @eerhardt

Customer Impact

Scenario: When trying to resolve a transient service expecting a (non-registered) service with a default value set (of null).

When this issue hits, the apps get a first chance exception (NRE) in the background and would then end up using a worse performing reflection rather than Ref.Emit code on the transient services.

Testing

Using the regression test that is part of this PR.

Risk

Low - Fixing an NRE to return the Type of the parameter when the default value is null.

Regression from 3.0?

Yes. From Pull Request #2501 · dotnet/extensions

@maryamariyan maryamariyan added Servicing-consider Issue for next servicing release review area-Extensions-DependencyInjection labels Nov 18, 2020
@maryamariyan maryamariyan self-assigned this Nov 18, 2020
@ghost
Copy link

ghost commented Nov 18, 2020

Tagging subscribers to this area: @eerhardt, @maryamariyan
See info in area-owners.md if you want to be subscribed.

Issue Details
Description:

Backport of #44675 to release/5.0

/cc @eerhardt

Customer Impact

Scenario: When trying to resolve a transient service expecting a (non-registered) service with a default value set (of null).

When this issue hits, the apps gets a first chance exception in the background and would then end up using a worse performing reflection rather than Ref.Emit code on scoped and transient services.

Testing

Using the regression test that is part of this PR.

Risk

Low - Fixing an NRE to return the Type of the parameter when the default value is null.

Author: maryamariyan
Assignees: maryamariyan
Labels:

Servicing-consider, area-Extensions-DependencyInjection

Milestone: -

@ericstj
Copy link
Member

ericstj commented Nov 19, 2020

@Anipik do we need to add the package changes and version to this?

@Anipik
Copy link
Contributor

Anipik commented Nov 19, 2020

@Anipik do we need to add the package changes and version to this?

yes we require the entire thing, packageVersion, AssemblyVersion, & packageIndex Update, also need to add this package to libraries-packages.proj

@maryamariyan
Copy link
Member Author

yes we require the entire thing, packageVersion, AssemblyVersion, & packageIndex Update, also need to add this package to libraries-packages.proj

updated.

@maryamariyan maryamariyan force-pushed the port-nre branch 2 times, most recently from 8743589 to 65df681 Compare November 24, 2020 15:59
@ghost
Copy link

ghost commented Nov 24, 2020

Hello @maryamariyan!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@danmoseley
Copy link
Member

JIT failure is #44831

<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<PackageVersion>5.0.1</PackageVersion>
<AssemblyVersion>5.0.0.1</AssemblyVersion>
Copy link
Member

Choose a reason for hiding this comment

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

@dougbu @Anipik remind me what our plan is for references shared in the transport package? Did we agree to freeze the assembly version or no? If so, then we should move the AssemblyVersion change to the src project.

Copy link
Member

Choose a reason for hiding this comment

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

@ericstj we agreed dotnet/runtime shouldn't create the transport package unless we really need to service the targeting packs. I don't remember if @Pilchie's document specifically covers $(AssemblyVersion) for ref/ assemblies but do recall it recommends not changing $(AssemblyVersion) for anything but Framework assemblies in servicing.

Copy link
Member

Choose a reason for hiding this comment

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

I believe in that document we concluded that assemblyVersion should change only apply to the net4x targetframeworks when an assembly overlaps the shared framework. We could follow that rule here. @Anipik did you have anything in the servicing doc about this with respect to ensuring servicable ref packs?

Copy link
Contributor

Choose a reason for hiding this comment

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

we concluded that assemblyVersion should change only apply to the net4x targetframeworks when an assembly overlaps the shared framework

yes we increment if we have any asset that applies netfx or netstandard, following the same thing here.

@Anipik did you have anything in the servicing doc about this with respect to ensuring servicable ref packs?

sadly nothing in the servicing doc with respect to ref packs. We need to add few more templates as well, i can add ref pack specific guidelines with that

Copy link
Member

Choose a reason for hiding this comment

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

we concluded that assemblyVersion should change only apply to the net4x targetframeworks when an assembly overlaps the shared framework

yes we increment if we have any asset that applies netfx or netstandard, following the same thing here.

@Anipik this doesn't seem to match the condition @ericstj described. NetStandard assemblies from projects that end up in the shared framework shouldn't vary because it ties external libraries to specific shared framework versions.

The exact Condition for stable versions (overriding Arcade's defaults) in dotnet/aspnetcore is '$(IsAspNetCoreApp)' == 'true' AND '$(Language)' == 'C#' AND '$(TargetFrameworkIdentifier)' != '.NETFramework'. This (plus targeting or multi-targeting net5.0 in those projects) means all assemblies in Microsoft.AspNetCore.App from our repo have stable versions and the same is true of separately-shipped NetStandard assemblies from those projects. Everything else varies in servicing.

Crucially this is not what dotnet/runtime is doing for assemblies that end up in Microsoft.AspNetCore.App. So far, Microsoft.Extensions.DependencyInjection and System.IO.Pipelines have new assembly versions. I needed to workaround the first change and revert bfc1ec679202 / #25851 (to handle the second) in #28087. bfc1ec679202 was our change in expectation of stable assembly versions from dotnet/runtime.

@maryamariyan
Copy link
Member Author

Failures are tracked by #45168 and #44831

@maryamariyan maryamariyan merged commit 4cfc831 into dotnet:release/5.0 Nov 25, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants