Apm-agent-dotnet: Agent reports incorrect ASP.NET version (on Full Framework)

Created on 16 Jun 2019  路  15Comments  路  Source: elastic/apm-agent-dotnet

When running on Windows 10 (build 1809 - October 2018 Update) at the bottom of error page (aka ASP.NET yellow screen of death) it says

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3282.0

although HTTP response contains header

"x-AspNet-Version": "4.0.30319"

https://en.wikipedia.org/wiki/ASP.NET says that Windows 10 build 1709 (Fall Creators Update) has ASP.NET 4.7.1 so it would make sense for Windows 10 build 1809 to have ASP.NET 4.7.3282.0

In any case agent reports ASP.NET version as 4.0.0.0

bug .NET Framework

All 15 comments

Indirectly related to #199

4.0.30319 is probably the CLR version.

Maybe it'd be worth trying to report the version of System.Web.dll. I think that's aligned to the .NET Framework version.

Or we can implement some super complicated logic calculating the framework version based on every combination, like in this doc.

Do you mean that we should report .NET Framework name/version in metadata.service.framework and not ASP.NET name/version, or is it the same version anyway?
Please note that I opened #199 to report .NET Framework name/version in metadata.service.runtime.

Do you mean that we should report .NET Framework name/version in metadata.service.framework and not ASP.NET name/version, or is it the same version anyway?

I think in case of ASP.NET it's the same, but I'm not 100% sure. But this is a good point.

I think in metadata.service.framework we should report the version of System.Web.dll - since that's the framework (in this case ASP.NET), and in case of metadata.service.runtime either the CLR version or the .NET Framework version. Reporting the .NET Framework version feels more complicated (see linked doc), but probably more useful for users.

What about the versions at the bottom of ASP.NET error page - wouldn't it make sense to align with those? ASP.NET is open source now so we can just look up where those numbers are coming from. What do you think?

It seems that we are not the only ones interested - https://github.com/aspnet/AspNetWebStack/issues/144 :)

What about the versions at the bottom of ASP.NET error page - wouldn't it make sense to align with those?

If we report the CLR version, then I think we report the same. If we go with the .NET Framework version then we probably don't report that number. I'm not sure that people are interested in the CLR version... they usually care about the .NET Framework version. Also I suspect for some users it'd be even confusing... they run the app on let's say .NET Framework 4.7.x and we report 4.0.x. I think that number on the error page is very confusing. But this is just my feeling without any data backing this.

ASP.NET is open source now so we can just look up where those numbers are coming from.

Is System.Web.dll also open source? I don't think so, but if that's the case then, sure we can figure out what they do.

https://github.com/microsoft/referencesource/blob/master/System.Web/ErrorFormatter.cs#L431

SR.GetString(SR.Error_Formatter_CLR_Build) + VersionInfo.ClrVersion +
SR.GetString(SR.Error_Formatter_ASPNET_Build) + VersionInfo.EngineVersion + "\r\n\r\n");

Yes, I agree that displaying 4.0.* when installed .NET Framework is 4.7.* is very confusing.

https://github.com/microsoft/referencesource/blob/master/System.Web/ErrorFormatter.cs#L431

SR.GetString(SR.Error_Formatter_CLR_Build) + VersionInfo.ClrVersion +
SR.GetString(SR.Error_Formatter_ASPNET_Build) + VersionInfo.EngineVersion + "\r\n\r\n");

Well... this is what I'd not do :) I think the ClrVersion is the less important one. What do you think?

RuntimeInformation.FrameworkDescription does return something that makes sense .NET Framework 4.7.3416.0

We wrote the same time. Ok, nice, I think we agree on this one :) If we find a fitting field to report the CLR version we should do that, but primarily I think we should report the ASP.NET and the .NET Framework versions - even if those are the same.

But ASP.NET version is still tricky.
It's strange that error page says ASP.NET Version:4.7.3282.0 when RuntimeInformation.FrameworkDescription says .NET Framework 4.7.3416.0.
I don't know if System.Web assembly version is going to be useful - at the same environment typeof(System.Web.HttpRuntime).Assembly.GetName().FullName returns System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. BTW System.Web assembly version is what we report as metadata.service.framework at the moment.

at the same environment typeof(System.Web.HttpRuntime).Assembly.GetName().FullName returns System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

That's very unfortunate. If Microsoft doesn't properly version that dll then my idea won't work. :(

Version printed as ASP.NET Version at the bottom of the error page is stored in VersionInfo.EngineVersion which unfortunately is an internal property of an internal class in System.Web assembly but we can get to it using reflection and fallback to version in RuntimeInformation.FrameworkDescription (4.7.*) if reflection access fails. What do you think?

Was this page helpful?
0 / 5 - 0 ratings