Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Add framework to diagnostic from compilation #2268

Closed
wants to merge 6 commits into from
Closed

Add framework to diagnostic from compilation #2268

wants to merge 6 commits into from

Conversation

troydai
Copy link
Contributor

@troydai troydai commented Jul 15, 2015

Addressing #1722

Adding framework information to the diagnostic message print to the Console. It is supposed to be picked up by VS and flow to WTE with the framework information.

We used to use CSharpDiagnosticFormatter to format the Diagnostic into message. However it is basically not extensible (with one virtual method do it all).
https://github.com/dotnet/roslyn/blob/master/src/Compilers/Core/Portable/Diagnostic/DiagnosticFormatter.cs

I added RoslynDiagnosticFormatter to serialize the message using the same logic as DiagnosticFormatter but insert the framework in it.

The information represents framework is it's identity. I was suggested by @BillHiebert that version is not required. I won't be able to insert the friendly name because Microsoft.Framework.Runtime.Roslyn.Common doesn't depends on Microsoft.Framework.Runtime to avoid circular dependencies. But the framework identity should be enough to parse it back to FrameworkName.

Here's a sample output:

$ dnu build
Microsoft .NET Development Utility CLR-x86-1.0.0-t150716000045


Building playground for DNX,Version=v4.5.1
  Using Project dependency playground 1.0.0
    Source: C:\code\playground\project.json

  Using Assembly dependency framework/fx/mscorlib 4.0.0.0
    Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\mscorlib.dll

  Using Assembly dependency framework/fx/System 4.0.0.0
    Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.dll

  Using Assembly dependency framework/fx/System.Core 4.0.0.0
    Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.Core.dll

  Using Assembly dependency framework/fx/Microsoft.CSharp 4.0.0.0
    Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Microsoft.CSharp.dll

C:\code\playground\Program.cs(6,5): DNX error CS1519: Invalid token '}' in class, struct, or interface member declaration

Building playground for DNXCore,Version=v5.0
  Using Project dependency playground 1.0.0
    Source: C:\code\playground\project.json

  Using Package dependency System.Runtime 4.0.20-beta-23110
    Source: C:\Users\Xueyuan\.dnx\packages\System.Runtime\4.0.20-beta-23110
    File: ref\dotnet\System.Runtime.dll

  Using Package dependency System.Private.Uri 4.0.0-beta-23110
    Source: C:\Users\Xueyuan\.dnx\packages\System.Private.Uri\4.0.0-beta-23110

C:\code\playground\Program.cs(6,5): DNXCore error CS1519: Invalid token '}' in class, struct, or interface member declaration

Building playground for .NETPlatform,Version=v5.0
  Using Project dependency playground 1.0.0
    Source: C:\code\playground\project.json

  Using Package dependency System.Runtime 4.0.20-beta-23110
    Source: C:\Users\Xueyuan\.dnx\packages\System.Runtime\4.0.20-beta-23110
    File: ref\dotnet\System.Runtime.dll

C:\code\playground\Program.cs(6,5): .NETPlatform error CS1519: Invalid token '}' in class, struct, or interface member declaration

@troydai
Copy link
Contributor Author

troydai commented Jul 16, 2015

/cc @davidfowl @BillHiebert

@troydai
Copy link
Contributor Author

troydai commented Jul 16, 2015

/cc @muratg

@troydai troydai closed this Jul 16, 2015
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.

None yet

2 participants