{"id":16366632,"url":"https://github.com/lecaillon/conan.plugin.nullguard","last_synced_at":"2026-05-09T09:43:32.953Z","repository":{"id":77262876,"uuid":"139312436","full_name":"lecaillon/Conan.Plugin.NullGuard","owner":"lecaillon","description":"Conan plugin adds null guard code for all methods and constructors parameters preceded by a [NonNull] attribute.","archived":false,"fork":false,"pushed_at":"2018-07-03T23:37:20.000Z","size":19,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-31T01:41:36.277Z","etag":null,"topics":["compiler-plugin","conan","dotnet","guard","null-check","roslyn","roslyn-analyzer"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lecaillon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-01T08:29:24.000Z","updated_at":"2018-07-03T23:37:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"d6e03736-808c-4e05-89a4-92c16126420d","html_url":"https://github.com/lecaillon/Conan.Plugin.NullGuard","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lecaillon%2FConan.Plugin.NullGuard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lecaillon%2FConan.Plugin.NullGuard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lecaillon%2FConan.Plugin.NullGuard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lecaillon%2FConan.Plugin.NullGuard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lecaillon","download_url":"https://codeload.github.com/lecaillon/Conan.Plugin.NullGuard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239828207,"owners_count":19703817,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler-plugin","conan","dotnet","guard","null-check","roslyn","roslyn-analyzer"],"created_at":"2024-10-11T02:47:05.344Z","updated_at":"2026-02-17T08:30:17.647Z","avatar_url":"https://github.com/lecaillon.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Conan.Plugin.NullGuard  [![Build status](https://ci.appveyor.com/api/projects/status/ov3kvojeu4s5ymxc/branch/master?svg=true)](https://ci.appveyor.com/project/lecaillon/conan-plugin-nullguard)\n\n\u003cimg align=\"right\" width=\"256px\" height=\"256px\" src=\"https://raw.githubusercontent.com/conan-roslyn/Conan/master/img/conan.png\"\u003e\n\nConan.Plugin.NullGuard adds null guard code for all methods and constructors parameters preceded by any `[NonNull]` attribute.\n\nIt is based on [Conan](https://github.com/conan-roslyn/Conan), a _lightweight_ fork of the [.NET Compiler Platform (\"Roslyn\")](https://github.com/dotnet/roslyn/) by adding a **compiler plugin infrastructure**. These plugins can be deployed and installed as regular Diagnostic Analyzers.\n\n## Notice\n\n\u003e This plugin is an alpha version, whose purpose is to see where the very promising Conan compiler plugin infrastructure can bring us.\n\n## Getting started\n\n1. Add the package `Conan.Net.Compilers` to your project: This will make the Conan compiler as the default CSharp/VB compiler and replace the default Roslyn compiler (This package works for both Full framework and Core framework unlike the Roslyn packages)\n2. Add the package `Conan.Plugin.NullGuard` only available on [AppVeyor](https://ci.appveyor.com/project/lecaillon/conan-plugin-nullguard/build/artifacts) for now.\n\n## Example\n\n1. Add a `[NonNull]` attribute to any constructor or method reference type parameter you want to check.\n\n```c#\npublic class Person\n{\n  private readonly string _name;\n  private readonly int _age;\n\n  public Person([NonNull] string name, int age)\n  {\n    _name = name;\n    _age = age;\n  }\n}\n```\n\n2. At build time the Conan Compiler will automatically insert at the beginning of the constructor the statement needed to ensure the parameter `name` is not null.\n\n```c#\npublic class Person\n{\n  private readonly string _name;\n  private readonly int _age;\n\n  public Person([NonNull] string name, int age)\n  {\n    if (name == null)\n    {\n      throw new ArgumentNullException(\"name\");\n    }\n\n    _name = name;\n    _age = age;\n  }\n}\n```\n\n3. You can see rewritten documents on the disk in a sub directory of the obj folder or using ILSpy. Example: `\\obj\\Debug\\netcoreapp2.1\\GeneratedFiles\\Microsoft.CodeAnalysis.CSharp.Analyzers\\Conan.Person.cs`\n\n## Licensing\n\nSame license than Roslyn: [Apache-2.0](roslyn/License.txt)\n\n## Credits\n\nAlexandre MUTEL aka [xoofx](http://xoofx.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flecaillon%2Fconan.plugin.nullguard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flecaillon%2Fconan.plugin.nullguard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flecaillon%2Fconan.plugin.nullguard/lists"}