Skip to content

Using Roslyn to get class attributes works in console app but fails in unit test

Notifications You must be signed in to change notification settings

sschmid/RoslynUnitTestIssue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Roslyn Unit Test Issue

Setup

  • One classlib project MyClasslib which contains one class MyClass.cs, which has an attribute [Obsolete("My Reason")]
  • One console project MyConsoleApp which contains Helper.cs which uses Roslyn to get the attributes from MyClass.cs
  • One unit test project Tests which also uses Helper.cs, but prints a different result which is unexpected!

Issue

Using Roslyn to get the attributes of MyClass.cs works as expected, but the same code fails whe running it in a unit test.

Expected output:

System.ObsoleteAttribute("My Reason")

Unit test output:

Obsolete

Why? Please help!

See #1

About

Using Roslyn to get class attributes works in console app but fails in unit test

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages