Skip to content

Development

C# - Get Display Attribute Value from Enum

Every now and then, I have a use case where decorating an Enum’s values with Attributes comes in handy. Things such as… Adding Display Names, Descriptions, etc.

Well, every time I have this use-case, I have to go google how I did it the previous time… and in most cases, StackOverflow is less then helpful. Then, I remember a few personal projects where I previously did this, and I find the code and reuse it.

TFS / Azure Devops - Semantic Versioning

I publish nuget packages. Alot of nuget packages.

I don’t have time to maintain nuget package versioning, so, I automatically generate versions based on the date and build number, like so: 2022.07.14.1

As well, I need support for alpha/beta/etc.

So, 2022.07.14.1-alpha.

Here is my method of doing it-

An anonymous request was received in between authentication handshake requests

I was receiving this error while hosting a webapi project on .net 5, using kestrel.

fail: Microsoft.AspNetCore.Authentication.Negotiate.NegotiateHandler[5]
      An exception occurred while processing the authentication request.
      System.InvalidOperationException: An anonymous request was received in between authentication handshake requests.
         at Microsoft.AspNetCore.Authentication.Negotiate.NegotiateHandler.HandleRequestAsync()
fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HM6A34N67LO5", Request id "0HM6A34N67LO5:00000005": An unhandled exception was thrown by the application.
      System.InvalidOperationException: An anonymous request was received in between authentication handshake requests.
         at Microsoft.AspNetCore.Authentication.Negotiate.NegotiateHandler.HandleRequestAsync()
         at Microsoft.AspNetCore.Authentication.Negotiate.NegotiateHandler.HandleRequestAsync()
         at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
         at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
         at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
         at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

Unknown error (0x80005000) – Getting AD Group Members

Earlier today, somebody asked me to help troubleshoot a piece of code which was randomly erroring out- with a very undescriptive exception, only containing Unknown error (0x80005000)

The code in question, was recurring over groups, to gather membership. After ruling out permissions issues, I decided to try and replicate what was happening.

c# – Logging Directly to Splunk

This is a portion of my Logging libraries, to allow me to log data to Splunk using the HEC. The data being logged can either be a simple string, or a full-blown object. Code examples are below to also handle exporting Metrics to Splunk.