docs/wiki/Contributing-Code.md
Before submitting a feature or substantial code contribution, please discuss it with the team and ensure it follows the product roadmap. The team rigorously reviews and tests all code submissions. The submissions must meet an extremely high bar for quality, design, and roadmap appropriateness.
The Roslyn project is a member of the .NET Foundation and follows the same developer guide. The team enforces this by regularly running the .NET code formatter tool on the code base. Contributors should ensure they follow these guidelines when making submissions.
For now, the team has set the following limits on pull requests:
When you are ready to proceed with making a change, get set up to build the code and familiarize yourself with our workflow and our coding conventions. These two blogs posts on contributing code to open source projects are good too: Open Source Contribution Etiquette by Miguel de Icaza and Don’t “Push” Your Pull Requests by Ilya Grigorik.
You must sign a Contributor License Agreement (CLA) before submitting your pull request. To complete the CLA, submit a request via the form and electronically sign the CLA when you receive the email containing the link to the document. You need to complete the CLA only once to cover all .NET Foundation projects.
See our getting started guide here.
Please follow these guidelines when creating new issues in the issue tracker:
Use the coding style outlined in the .NET Foundation Coding Guidelines
Use plain code to validate parameters at public boundaries. Do not use Contracts or magic helpers.
if (argument == null)
{
throw new ArgumentNullException(nameof(argument));
}
Use Debug.Assert() for checks not needed in retail builds. Always include a “message” string in your assert to identify failure conditions. Add assertions to document assumptions on non-local program state or parameter values, e.g. “At this point in parsing the scanner should have been advanced to a ‘.’ token by the caller”.
Avoid allocations in compiler hot paths:
The Roslyn team regularly uses the .NET code formatter tool to ensure the code base maintains a consistent style over time. The specific options we pass to this tool are the following:
/nounicode: In general we follow this rule of not having unicode characters embedded in string literals. However there are a few cases where this is needed to verify compiler behavior hence this option is disabled for now./copyright: The default copyright is MIT. Roslyn is released under Apache2 hence we need to override this option.For all of the C# guidelines which have analogs in Visual Basic, the team applies the spirit of the guideline to Visual Basic. Guidelines surrounding spacing, indentation, parameter names, and the use of named parameters are all generally applicable to Visual Basic. ‘Dim’ statements should also follow the guidelines for the use of ‘var’ in C#. Specific to Visual Basic, field names should begin with ‘m_’ or ‘_’. And the team prefers that all field declarations be placed at the beginning of a type definition. The Visual Studio members dropdown does not show fields in VB. Having them at the beginning of the type aids in navigation.
IDE features should generally be made for both C# and VB. The exceptions are:
When creating IDE features that work for both C# and VB, attempt to share as much code as is reasonable. There are numerous examples and existing components to make that possible. If help is needed, reach out to the team for advice.
Our team finds using this enhanced source view of Roslyn helpful when developing.
Many team members can be reached at https://gitter.im/dotnet/roslyn, https://gitter.im/dotnet/csharplang, and https://discord.gg/csharp (#roslyn).