-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Add Microsoft.CodeAnalysis.Contracts source package #76997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@dotnet/roslyn-ide @dotnet/roslyn-compiler PTAL |
That sounds reasonable to me, for consistency with the current state. Then we can discuss separately whether to include the |
820f4fe
to
948d2ea
Compare
948d2ea
to
32af181
Compare
<Compile Include="$(MSBuildThisFileDirectory)NullableAttributes.cs" /> | ||
<Compile Include="$(MSBuildThisFileDirectory)RequiredMemberAttribute.cs" /> | ||
<Compile Include="$(MSBuildThisFileDirectory)SetsRequiredMembersAttribute.cs" /> | ||
<Compile Include="$(MSBuildThisFileDirectory)ExceptionUtilities.cs" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not include glob *.cs
rather than explicitly including each file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glob works but next time you edit the project VS screws it up :(.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JakeRadMSFT Can we get this fixed please? dotnet/project-system#6010
Working with shared projects in VS is such a PITA.
The package is intended to include a small number of essential contracts and polyfills used across Roslyn code base and in other Roslyn source packages (see #76937).
Introduction of this package simplifies the set of file links in Roslyn repository, makes it easier to apply Roslyn coding patterns across other related repositories (e.g. dotnet-watch, Razor, WebTools, Interactive Window, etc) and to use other Roslyn source packages in these repositories.
Moves all non-polyfill types to
Microsoft.CodeAnalysis
namespace (instead ofRoslyn.Utilities
). This move makes these core types immediately available in all Roslyn types defined inMicrosoft.CodeAnalysis
namespace or a subnamespace.For
Contract
type, it avoids accidental mix-up withMicrosoft.Diagnostics.Contracts.Contract
type in non-VS layer, which doesn't benefit since it defines types underMicrosoft.VisualStudio
namespace.TODO:
Contract
type is not currently available in Compiler layer (only Workspace and up). We can use#if !MICROSOFT_CODEANALYSIS_CONTRACTS_NO_CONTRACT
to keep it that way if desired.ExceptionUtilities.Unreachable
andExceptionUtilities.UnexpectedValue
methods toContract
type. These helpers declare code contracts/assertions similar to those expressed byThrow*
methods inContract
class.