PSA: DotNetCoreVerbosity enum has changed into a class - lolwat! #3788
Replies: 1 comment 1 reply
-
👋🏻 This was by design in order to maintain compile-time compatibility with Cake v1 code, with the introduction of the new Two enums were changed to classes in v2: You seem to be using reflection to parse a string to an enum, so understandably you get a runtime error. If you were using the "Cake way" of parsing arguments, you would not have been affected by this - as we included a converter. var dotnetVerbosity = Argument<DotNetCoreVerbosity>("dotnetVerbosity", DotNetCoreVerbosity.Normal);
Information("dotnet verbosity set to {0}", dotnetVerbosity); dotnet cake build.cake --dotnetVerbosity=Diagnostic |
Beta Was this translation helpful? Give feedback.
-
This is just a comment to help any poor developer who hits this issue in the future. I spent 3 hours debugging this, hours I will never get back! 😭
Problem
The
DotNetCoreVerbosity
enum in Cake v1.0 has changed into a class in Cake v2.0. Diabolical.If you are using any enum helper utils (I had code like
Enum.TryParse(...)
), you'll see nonsensical errors when you upgrade.Solution
Switch over to using the
DotNetVerbosity
enum, which mercifully is still an actual, you know, enum.Note
I only encountered this issue with this enum, but without looking through the whole codebase I suspect there are other enums that have been... err classified.
Beta Was this translation helpful? Give feedback.
All reactions