• Avoiding server errors when generating thumbnails in Sitecore
    We routinely monitor the logs of the websites we work on, and in the post I am going to describe one issue I recently located and fixed in a Sitecore 10.3 XM solution. The issue generated bursts of 500 server errors in the logs when a content editor accessed the Media Library via the Sitecore […]
  • Problems with using Multi-Line Text fields for HTML in Sitecore
    In this post I will describe a bug we fixed in Sitecore 10.3 yesterday. The bug affects the Experience Editor and prevent certain combinations for HTML tags (<link>, <a>, <img> and <image>) from being saved correctly in a Multi-Line Text field. To understand the bug, lets first look at the module where this bug appeared: […]
  • Copying content between databases in Sitecore
    In this post I will describe some of the methods we have for copying items between databases in Sitecore. We can use these methods when content has been corrupted or is missing in one database but can be salvaged from another. If you are reading this post, you are probably in some extraordinary situation, so […]
  • Scheduled publishing in Sitecore
    I recently helped a colleague implement a lightweight scheduled publishing functionality in Sitecore 10.2. The solution allows content editors to schedule the publishing and unpublishing of content using the existing publishing restrictions and is lightweight in terms of code and impact on the overall solution. In a standard Sitecore installation, publishing of content is a […]
  • Sitecore wildcard items
    In Sitecore, we have the option to use “wildcard” items to capture multiple URLs with a single piece of content. The goal of this blog post is to provide an overview of how this out-of-the-box wildcard resolving works in regard to URLs, paths, queries and when using Sitecore Content Search. The post is based on […]
  • Exploring Sitecore Jobs
    As a Sitecore developer you are likely familiar with Sitecore Jobs. Sitecore Jobs is a great way for starting and monitoring long-running tasks on a Sitecore webserver. In this post I will explore some ideas I have been exploring with regards to extending Sitecore Jobs a bit. It revolves around two topics – firstly, making […]
  • Implementing an internal Sitecore interface
    I recently worked with a colleague on implementing support for SearchStax’s Disaster Recovery feature on Sitecore 10.2. While the implementation is not the topic of this post, we faced a peculiar problem when applying it: We needed to implement an internal Sitecore interface. This post will describe how this can be done. Implementing an internal […]
  • Debugging a Sitecore solution
    In this post I am going to describe an approach for identifying and removing bugs from a Sitecore solution. This approach is broad and heuristic in nature, mostly based on personal experiences. If you wish to dive further into the methodologies used in debugging, a good starting point is the Wikipedia article on debugging (https://en.wikipedia.org/wiki/Debugging). […]
  • The Experience Editor in headless Sitecore using Next.js: API Routes Response Size Limited to 4MB
    I am currently working on a headless Sitecore solution using Next.js and Experience Edge. In this post I am going to explain one particular fix we had to do, to avoid sending excessive amounts of data to the rendering engine when using the Experience Editor causing the /api/editing/render to fail. Sitecore’s Experience Editor allows a […]
  • Sitecore field data corruption
    When we develop solutions based on Sitecore, we create custom code as well as Sitecore content. The code is stored in a version control system like Git, whereas the Sitecore contents exists inside a number of Sitecore SQL databases. Sometimes it makes sense to make some of the Sitecore content “part” of the code, especially […]
  • Setting up Rainbow SFS for Unicorn in Sitecore
    When multiple developers work on the same Sitecore solution, it is necessary to have mechanisms for sharing an evolving solution across a number of local installations. For the code files, mature version control system like Git efficiently track changes and synchronize these between computers. Conflicts between changes are handled by tested-and-proven workflows known and understood by […]
  • Generic interface co- and contravariance in C#
    In this post, I will explore generic interface co- and contravariance in C# (introduced in 4.0). Let’s start with a simple example: Suppose we have two classes, Person and Student and a container that implements a generic interface and holds a single item: public class Person { public string Name { get; set; } } […]
  • Faceted search in WordPress
    About a month ago I talked to a friend of mine about WordPress and PHP. Being a staunch .NET loyalist he quickly concluded that he had no time for sloppy PHP. PHP supports both procedural and object-oriented paradigms and WordPress is a prime example of why this is not always a good idea: The WordPress […]
  • Echo server
    This spring, I follow a course in mobile and distributed systems at the IT University of Copenhagen. During the course, I am going to post some of my homework to this blog. The course is part of the The Master of Science in Software Development and Technology programme, and focuses on distributed programming, concurrency, Web […]
  • WCF exception handling
    I recently read a old post on http://www.techinterviews.com containing interview questions for C# developers. One questions goes: ”Why is it a bad idea to throw your own exceptions?” And the answer is “Well, if at that point you know that an error has occurred, then why not write the proper code to handle that error […]
  • Microsoft Team Foundation Server: Moving from Visual Source Safe
    As a developer at Magnetix A/S, I am currently spearheading the implemention of Microsoft Team Foundation Server (TFS) across the organization. This include moving most of our codebase from our old Visual Source Safe, setting up custom project templates and describing best practices and workflows. The process have not been without problems, but my general […]
  • Modifiers
    Modifiers in C# are keywords added to class and field declarations (and in some cases enums, interfaces and structs as well). C# supports a wide range of modifiers, and in this post, I will go through some of the advanced modifiers and explaining how they can be used. The concept of modifiers is in itself not that […]
  • Using generic methods and constraints
    Generic methods are a powerful way to provide type safety yet creating flexible methods that support multiple types. The idea behind a generic metode is simple: A generic method accept parameters and returns values of a range of different types. Hence it is generic, opposite to specific. But there is a little more to the story. Let us […]
  • Formatting enums using CustomFormatters
    C# enums are named constants, making code easier to write and read. But the enum names should not be written to the UI. This post shows two methods of formatting an enum to a string suitable for the UI. A C# enum is simply a named constant: Let’s say you are working on a application where you need to […]
  • First experience with Sitecore 6
    I just started a new project, my first one in Sitecore 6. Sitecore have improved 5.3 in a number of ways. The installation was not without its problem. The installer complained about a missing ASPNET user, although the user was clearly present. Hence I ignored the warning, and continued. After installing the files, I tried […]
  • Overflow, checked and unchecked
    The CLR supports both unchecked and checked integer arithmetics. This post explains how this is exposed in the C# language. As default, C# does integer arithmetics in a unchecked context. In a unchecked context division by zero throws a exception, whereas overflow does not. Overflow happens when the range of a type is exceeded, e.g. […]
  • Shared classes and Web Services
    The Windows Communication Foundation Services have simplified the way you use classes in distributed application. Windows Communication Foundation (WCF) expands the .NET WebServices technologies. One exciting feature is the Data Contracts abilities that enables you to marshall data structures more seamlessly through the service. The “classic” .NET WebService (as well as a WCF service) exposes […]
  • Paths in User Controls
    This post is about the different way to write paths in User Control, and about the special ASP.NET Web Application root operator. Ever wondered how paths in ASP.NET User Control are resolved when the control is being consumed by web pages in different locations? I did. So I made a simple control named MyControl.ascx in […]
  • Method signatures
    With a few simple tricks, you can avoid those annoying changes in the method signatures in your application. Method signatures are important point of integration in your application, and hence changes in your method signatures can be both annoying and error prone, and even break applications that consumes your code. So method signatures should be […]
  • Dynamic Compilation in a Web Application
    With a simple trick, you can mimic the dynamic complilation of a Web Site in a Web Application. Visual Studio 2008 comes with the Web Application project type build-in. As you may know, the main difference between a Web Application and a Web Site is that a Web Application must be compiled, whereas a Web […]
  • Strings the right way
    In this post, I will show how you can optimize your string operations by using the StingBuilder class and the static class String. I’ve done it tons of times: Concating string the wrong way. Concatenation is the process of joining strings. And if I have a string s1 = “Hello”, and I want to append […]
  • Rotation around an vector in C#/XNA
    This post show how you can rotate one vector around a arbitrary axis, represented by a second vector. This is done by defining a rotation matrix. I was playing around with the Microsoft XNA framework, and needed a way to rotate a vector around a second vector. Now I know that the framework probably include […]