Skip to content

Coding Practice

How to Fix the T4 Debugger in Visual Studio 16.9.X

Visual Studio 16.9 introduced a bug that prevents us from debugging T4 templates. The debugger rushes to the end of the template and fails with this message:

FileLoadException: Could not load file or assembly 'Microsoft.VisualStudio.Validation, Version=16.8.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Inherit XML Documentation Comments in C

I am a big fan of the XML documentation comments in C#. This documentation is directly in the code and has therefore the biggest chance to be updated when the code changes.

However, when you demand to document all public methods, you end up with a lot of repetitive documentation. As with duplicated code, you will update only the parts you remember, and the others will be outdated in no time. That quickly negates the benefits of having the documentation in the first place.

ASP.NET Core Identity: Use IEmailSender without SendGrid

ASP.NET Core Identity offers you a little interface called IEmailSender to wire up your own logic to send emails for account confirmation and password recovery. The official tutorial at Microsoft uses SendGrid for those emails. While this service has certainly its place, we do not want to change our email infrastructure just because we only can find tutorials for SendGrid.

StyleCop for .Net 5 Projects: Installation

When you work in a team it is of great importance that you all follow the same rules. Otherwise your turn a code base in a mess in no time. We settled for StyleCop because it allowed us to delegate the nitpicking of code formatting and code style to a tool that does it automatically at development time. That allows us to use the time in code reviews for the important parts.