Skip to content
Sven Hübner IT
  • Home
  • Blog

gotcha

  • Home
  • Blog
  • gotcha

Gotcha with .globalconfig and Visual Studio

Posted by By sven.huebner.it April 1, 2023Posted inBuild, General Development
VS will always apply a `.globalconfig`, not just when analyzers are activated like the CLI build does. Use a different name and explicit inclusion to get consistent behavior.
Read More

Just for fun: changing runtime behavior with unreachable code

Posted by By sven.huebner.it October 1, 2022Posted inUncategorized
Unreachable code can still change compiler behavior and thus runtime method behavior. An example with `yield`.
Read More

Nuget Packaging Series 2: Beware of DLL version conflicts

Posted by By sven.huebner.it July 10, 2022Posted inBuild
Putting assemblies with different TFMs in the same nuget package can lead to runtime assembly loading errors because of transitive assembly reference version conflicts.
Read More

Closed Type Hierarchies with records … NOT!

Posted by By sven.huebner.it February 23, 2022Posted inGeneral Development1 Comment
TL;DR: You cannot create closed type hierarchies with record types because of the generated protected copy constructor.
Read More

Record type gotcha with FluentAssertions 5

Posted by By sven.huebner.it July 22, 2021Posted inTesting
Use version 6+ of FluentAssertions when asserting equality of record types with collections in them.
Read More

Gotcha with C# 9 Record inheritance and ToString()

Posted by By sven.huebner.it November 20, 2020Posted inGeneral Development1 Comment
On record types, ToString() and other compiler-synthesized methods cannot be overridden up the inheritance hierarchy in parent records, but must be overridden in the concrete record.
Read More

Gotcha with xsd.exe and XmlSerializer

Posted by By sven.huebner.it August 8, 2020Posted inGeneral Development
TL;DR: Always use the /order option when using xsd.exe. If you have ever generated C# classes from an XML schema, chances are you used xsd.exe for that.You probably also expected…
Read More

Gotcha during migration to async/await

Posted by By sven.huebner.it July 13, 2020Posted inGeneral Development
TL;DR: Use Lindhart.Analyser.MissingAwaitWarning to get warnings on all ignored Tasks We all know and love compiler warning CS4014 for ignoring Tasks.You would think that this warning triggers every time we…
Read More
Copyright 2025 — Sven Hübner IT. All rights reserved. Sinatra WordPress Theme
Scroll to Top