.NET Core - System.Private.CoreLib.dll vs System.Runtime
Asked Answered
E

1

18

In a .NET Core App, if I do

typeof(DateTime).Assembly.Location

I get

C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.4\System.Private.CoreLib.dll

But the documentation for the DateTime struct says the assembly is System.Runtime.dll

I am trying to locate the XML Documentation file for DateTime. I cannot locate a System.Private.CoreLib.xml on my system but a System.Runtime.xml does accompany the System.Runtime.dll file in its folder (per XML documentation convention).

How does System.Private.CoreLib.dll relate to System.Runtime.dll ?

I am trying to use Roslyn to grab the XML <Summary> tag content, (similar to a hover tooltip in Visual Studio) but I cant see how to associate a Type with the location of the XML documentation ?

Eighteenth answered 1/6, 2020 at 8:47 Comment(6)
Doesn't Roslyn already handle this for you?Cobnut
Not that I can see from any of the information I have read. It seems like the XML document resolution is still manual.Eighteenth
I did some digging. See if CompletionItem.Description from CompletionService is of any help.Cobnut
Appreciate the digging. CompletionItem.InlineDescription is always blank. I get the feeling this is for another purpose. I also checked CompletionService.GetDescription() but it returns DateTime DateTime.Add(TimeSpan value) as an example.Eighteenth
I can actually get the description via Roslyn, the problem is I need to resolve and supply the path to the XML documentation file, roslyn does not do this internally.Eighteenth
System.Private.CoreLib.dll documentation is mscorlib.xml. System.Runtime.dll documentation is System.Runtime.xml. System.Runtime.dll is a reference assembly and references System.Private.CoreLib.dll so, they both share many types in common. XML-documentation of the same types are in these 2 XML files and sometimes they are different.Boloney
C
7

How does System.Private.CoreLib.dll relate to System.Runtime.dll ?

System.Runtime.dll is a so-called Reference assembly, which means it's only containing the public API without implementation:

Reference assemblies are a special type of assembly that contain only the minimum amount of metadata required to represent the library's public API surface.

For the actual implementation it's forwarding to other assemblies, the so-called implementation assemblies. One of these implementation assemblies is System.Private.CoreLib.dll.

Cryptonymous answered 11/1, 2023 at 16:6 Comment(1)
Is there a way to determine that relationship using reflection, so the correct xml documentation file can be loaded ?Eighteenth

© 2022 - 2024 — McMap. All rights reserved.