{"action":"created","issue":{"url":"https://api.github.com/repos/SonarSource/sonarlint-vs/issues/663","labels_url":"https://api.github.com/repos/SonarSource/sonarlint-vs/issues/663/labels{/name}","comments_url":"https://api.github.com/repos/SonarSource/sonarlint-vs/issues/663/comments","events_url":"https://api.github.com/repos/SonarSource/sonarlint-vs/issues/663/events","html_url":"https://github.com/SonarSource/sonarlint-vs/issues/663","id":120120485,"number":663,"title":"Sealed classes with private constructor cannot be instantiated","user":{"login":"tvsonar","id":11485373,"avatar_url":"https://avatars.githubusercontent.com/u/11485373?v=3","gravatar_id":"","url":"https://api.github.com/users/tvsonar","html_url":"https://github.com/tvsonar","followers_url":"https://api.github.com/users/tvsonar/followers","following_url":"https://api.github.com/users/tvsonar/following{/other_user}","gists_url":"https://api.github.com/users/tvsonar/gists{/gist_id}","starred_url":"https://api.github.com/users/tvsonar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tvsonar/subscriptions","organizations_url":"https://api.github.com/users/tvsonar/orgs","repos_url":"https://api.github.com/users/tvsonar/repos","events_url":"https://api.github.com/users/tvsonar/events{/privacy}","received_events_url":"https://api.github.com/users/tvsonar/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/SonarSource/sonarlint-vs/labels/C%23","name":"C#","color":"ebfec0"},{"url":"https://api.github.com/repos/SonarSource/sonarlint-vs/labels/rule-idea","name":"rule-idea","color":"d4c5f9"}],"state":"open","locked":false,"assignee":{"login":"ganncamp","id":1313491,"avatar_url":"https://avatars.githubusercontent.com/u/1313491?v=3","gravatar_id":"","url":"https://api.github.com/users/ganncamp","html_url":"https://github.com/ganncamp","followers_url":"https://api.github.com/users/ganncamp/followers","following_url":"https://api.github.com/users/ganncamp/following{/other_user}","gists_url":"https://api.github.com/users/ganncamp/gists{/gist_id}","starred_url":"https://api.github.com/users/ganncamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ganncamp/subscriptions","organizations_url":"https://api.github.com/users/ganncamp/orgs","repos_url":"https://api.github.com/users/ganncamp/repos","events_url":"https://api.github.com/users/ganncamp/events{/privacy}","received_events_url":"https://api.github.com/users/ganncamp/received_events","type":"User","site_admin":false},"milestone":null,"comments":5,"created_at":"2015-12-03T08:51:16Z","updated_at":"2015-12-08T15:53:59Z","closed_at":null,"body":"R# _ClassCannotBeInstantiated_\r\n\r\n```C#\r\npublic sealed class MyClass // Noncompliant\r\n{\r\n  private MyClass() { ... }\r\n}\r\n```\r\n\r\n`MyClass` can't be instantiated. \r\n\r\nException: if you instantiate it inside the class (singleton, or [smart enum](http://blog.falafel.com/introducing-type-safe-enum-pattern/) pattern), or if you use reflection. For the latter one, we can't really have a good check, but it's worth checking if there's any member in the class who has a `MyClass` return type, or parameter type. That's a good indicator that somehow it's possible to create an instance of the class. \r\n\r\nThere are probably two compliant solutions\r\n* the constructor should be `public`, or \r\n* the `sealed` should be removed."},"comment":{"url":"https://api.github.com/repos/SonarSource/sonarlint-vs/issues/comments/162925378","html_url":"https://github.com/SonarSource/sonarlint-vs/issues/663#issuecomment-162925378","issue_url":"https://api.github.com/repos/SonarSource/sonarlint-vs/issues/663","id":162925378,"user":{"login":"ganncamp","id":1313491,"avatar_url":"https://avatars.githubusercontent.com/u/1313491?v=3","gravatar_id":"","url":"https://api.github.com/users/ganncamp","html_url":"https://github.com/ganncamp","followers_url":"https://api.github.com/users/ganncamp/followers","following_url":"https://api.github.com/users/ganncamp/following{/other_user}","gists_url":"https://api.github.com/users/ganncamp/gists{/gist_id}","starred_url":"https://api.github.com/users/ganncamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ganncamp/subscriptions","organizations_url":"https://api.github.com/users/ganncamp/orgs","repos_url":"https://api.github.com/users/ganncamp/repos","events_url":"https://api.github.com/users/ganncamp/events{/privacy}","received_events_url":"https://api.github.com/users/ganncamp/received_events","type":"User","site_admin":false},"created_at":"2015-12-08T15:53:59Z","updated_at":"2015-12-08T15:53:59Z","body":"https://jira.sonarsource.com/browse/RSPEC-3453"}}