Question: GetConnectionString in Microsoft.Extensions.Configuration.ConfigurationExtensions
See original GitHub issueAsp.NET Core v3.0
In VS2019 I press F12 while method GetConnectionString
is in focus and a metadata file opens, where it shows the location of the source code:
// C:\Program Files\dotnet\packs\Microsoft.AspNetCore.App.Ref\3.0.0\ref\netcoreapp3.0\Microsoft.Extensions.Configuration.Abstractions.dll
Now when I open the above dll
, my Decompiler shows
public static string GetConnectionString(this IConfiguration configuration, string name) { throw null; }
But this is not the implementation.
So I searched for it in this repo and found this ref
branch which depicts this code above and a src
branch which shows the actual implementation:
public static string GetConnectionString(this IConfiguration configuration, string name) { return configuration?.GetSection("ConnectionStrings")?[name]; }
What is the `ref` branch? Or better, why do I not see the real implementation when using my decompiler
Ref branch: src/Configuration/Config.Abstractions/ref/Microsoft.Extensions.Configuration.Abstractions.netstandard2.0.cs
Src branch: src/Configuration/Config.Abstractions/src/ConfigurationExtensions.cs
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
It does not make decompiler obsolete, you just have to supply actual implementation assembly as input for it. It is contained in Microsoft.Extensions.Configuration.Abstractions in
lib
subdirectory. It should be cached somewhere on your local disk if you were recently building something targeting it; or you can load it from NuGet Gallery yourself if it’s not.No idea why source.dot.net currently works so horribly and fails to find half of BCL types, though. Hope that’s just a temporary issue.
In short: it is better for tooling (Visual Studio).
Further infos: