{"id":16203315,"url":"https://github.com/sschmid/roslynunittestissue","last_synced_at":"2025-04-07T19:18:34.220Z","repository":{"id":150391021,"uuid":"577378561","full_name":"sschmid/RoslynUnitTestIssue","owner":"sschmid","description":"Using Roslyn to get class attributes works in console app but fails in unit test","archived":false,"fork":false,"pushed_at":"2022-12-13T09:51:24.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-13T20:44:19.318Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sschmid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-12-12T15:52:13.000Z","updated_at":"2023-07-03T16:49:21.000Z","dependencies_parsed_at":"2023-05-05T14:46:49.076Z","dependency_job_id":null,"html_url":"https://github.com/sschmid/RoslynUnitTestIssue","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/sschmid%2FRoslynUnitTestIssue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sschmid%2FRoslynUnitTestIssue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sschmid%2FRoslynUnitTestIssue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sschmid%2FRoslynUnitTestIssue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sschmid","download_url":"https://codeload.github.com/sschmid/RoslynUnitTestIssue/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247713259,"owners_count":20983683,"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":[],"created_at":"2024-10-10T09:53:44.856Z","updated_at":"2025-04-07T19:18:34.177Z","avatar_url":"https://github.com/sschmid.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Roslyn Unit Test Issue\n\n## Setup\n\n- One classlib project `MyClasslib` which contains one class [MyClass.cs](https://github.com/sschmid/RoslynUnitTestIssue/blob/main/MyClasslib/MyClass.cs), which has an attribute `[Obsolete(\"My Reason\")]`\n- One console project `MyConsoleApp` which contains [Helper.cs](https://github.com/sschmid/RoslynUnitTestIssue/blob/main/MyConsoleApp/Helper.cs) which uses Roslyn to get the attributes from [MyClass.cs](https://github.com/sschmid/RoslynUnitTestIssue/blob/main/MyClasslib/MyClass.cs) \n- One unit test project `Tests` which also uses [Helper.cs](https://github.com/sschmid/RoslynUnitTestIssue/blob/main/MyConsoleApp/Helper.cs), but prints a different result which is unexpected!\n\n## Issue\n\nUsing Roslyn to get the attributes of [MyClass.cs](https://github.com/sschmid/RoslynUnitTestIssue/blob/main/MyClasslib/MyClass.cs) works as expected, but the same code fails whe running it in a unit test.\n\n### Expected output:\n`System.ObsoleteAttribute(\"My Reason\")`\n\n### Unit test output:\n`Obsolete`\n\nWhy? Please help!\n\nSee https://github.com/sschmid/RoslynUnitTestIssue/issues/1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsschmid%2Froslynunittestissue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsschmid%2Froslynunittestissue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsschmid%2Froslynunittestissue/lists"}