Søren Kruse | Sitecore and .NET

Søren Kruse's picture

Søren Kruse

Sitecore developer with an interest in the more advanced stuff and elegant solutions to complex problems.

  1. MongoDB, C# and DateTimeOffset

    The MongoDB driver for C#/.NET can currently be serialized/deserialized in three different ways - as an array, object or string. You can control the BSON representation of your property by adding the [BsonRepresentation] attribute or set it on your class map. [BsonRepresentation(BsonType.String)] public DateTimeOffset EventStart { get;…

  2. Octopus C# script step not finishing unawaited async Tasks

    You might find yourself wanting to start an async Task either through Task.Run(() => ...) or something like Task DoSomethingAsync() or Task.Delay() where you don't want to await the completion of the task. You just want the step to complete and the task to continue running in the background.…

  3. ErgastApiClient - C# library for querying the Ergast Developer API (Formula 1 data)

    The Ergast Developer API (http://ergast.com/mrd/) is an awesome (experimental) web service which provides a historical record of Formula 1 data for non-commercial purposes. The API contains data all the back to the beginning in 1950. Some time ago I wanted to query some of this data and…

  4. Octopus Script Step Error: "Common Language Runtime detected an invalid program"

    You might run into the following error when deploying with Octopus and one of your tasks is executing a C# script (ScriptCS) on the target machine. ERROR: Script execution failed. [InvalidProgramException] Common Language Runtime detected an invalid program. Exit code: 1 The remote script failed with exit code 1 This…

  5. Filtering index searches by item security with correct paging and total results count

    Sitecore ContentSearch indexes does not check item security by default, but it can be enabled with a configuration setting by changing the value of /sitecore/contentSearch/indexConfigurations/defaultSearchSecurityOption from DisableSecurityCheck to EnableSecurityCheck. However, it does not really work with paging of the results (i.e skip/take) or the total…

  6. Sitecore Social Connected Exception: "Application in args should not be null"

    You might run into this exception when trying to log in using one of the social connectors that is part of the Sitecore Social Connected module (Facebook, Twitter, LinkedIn, Google+) ERROR Sitecore.Social: Application in args should not be null Exception: Sitecore.Social.NetworkProviders.Exceptions.AuthException Message: Exception of type…