15

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 ?

OrdinaryOrange
  • 2,420
  • 1
  • 16
  • 25
  • Doesn't Roslyn already handle this for you? – Tanveer Badar Jun 01 '20 at 10:41
  • Not that I can see from any of the information I have read. It seems like the XML document resolution is still manual. – OrdinaryOrange Jun 01 '20 at 10:46
  • I did some digging. See if `CompletionItem.Description` from `CompletionService` is of any help. – Tanveer Badar Jun 01 '20 at 14:39
  • 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. – OrdinaryOrange Jun 02 '20 at 00:51
  • 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. – OrdinaryOrange Jun 02 '20 at 00:52
  • 1
    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. – MarcioAB Apr 30 '21 at 22:48

1 Answers1

3

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.

Alex
  • 569
  • 5
  • 21