{"id":20688748,"url":"https://github.com/71/anyconstraint.analyzer","last_synced_at":"2026-05-19T09:11:39.863Z","repository":{"id":95480636,"uuid":"98665831","full_name":"71/AnyConstraint.Analyzer","owner":"71","description":"Analyzer that suppresses the CS0702 error, thus allowing any constraint to be used (including 'Delegate' and 'Enum').","archived":false,"fork":false,"pushed_at":"2017-11-09T22:15:57.000Z","size":17,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-05-08T20:12:21.249Z","etag":null,"topics":["analyzer","constraints","csharp","dotnet","roslyn"],"latest_commit_sha":null,"homepage":"https://preview.nuget.org/packages/AnyConstraint.Analyzer","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/71.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2017-07-28T16:03:39.000Z","updated_at":"2025-06-06T15:04:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"db24cf8c-697b-4585-b18d-7c5c2f015528","html_url":"https://github.com/71/AnyConstraint.Analyzer","commit_stats":null,"previous_names":["6a/anyconstraint.analyzer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/71/AnyConstraint.Analyzer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/71%2FAnyConstraint.Analyzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/71%2FAnyConstraint.Analyzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/71%2FAnyConstraint.Analyzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/71%2FAnyConstraint.Analyzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/71","download_url":"https://codeload.github.com/71/AnyConstraint.Analyzer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/71%2FAnyConstraint.Analyzer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33209661,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-19T07:54:09.561Z","status":"ssl_error","status_checked_at":"2026-05-19T07:54:08.508Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["analyzer","constraints","csharp","dotnet","roslyn"],"created_at":"2024-11-16T23:06:51.371Z","updated_at":"2026-05-19T09:11:39.859Z","avatar_url":"https://github.com/71.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"AnyConstraint.Analyzer\n======================\n\nA simple C# analyzer that suppresses the **CS0702**: \"Constraint cannot be special class 'Delegate' / 'Enum' / '...' \" error.\n\n## Installation\nSimply install the NuGet package, and the analyzer will be automatically added to your project.\n```powershell\nInstall-Package AnyConstraint.Analyzer\n```\n\n## Usage\nThere is no usage. Having the analyzer referenced is enough. The following code should compile just fine:\n```csharp\npublic static void Invoke\u003cTDelegate\u003e(TDelegate del) where TDelegate : Delegate { ... }\npublic static void GetValues\u003cT\u003e(T @enum) where T : Enum { ... }\n```\nNonetheless, an error will be shown in Visual Studio. To hide it from the 'Error List' panel, you can add the following code above your method:\n```csharp\n[SuppressMessage(\"Compiler\", \"CS0702\")]\n```\nOr, at the global level:\n```csharp\n[assembly: SuppressMessage(\"Compiler\", \"CS0702\")]\n```\n\n## How does it work?\nUsing [Ryder](https://github.com/6A/Ryder), the internal call to [`Binder.IsValidConstraintType`](http://source.roslyn.io/#Microsoft.CodeAnalysis.CSharp/Binder/Binder_Constraints.cs,14be8263fd49892c) is replaced by a simple `return true` statement, thus allowing any type to be used as a constraint.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F71%2Fanyconstraint.analyzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F71%2Fanyconstraint.analyzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F71%2Fanyconstraint.analyzer/lists"}