Author Archives: briancaos

About briancaos

Developer at Pentia A/S since 2003. Have developed Web Applications using Sitecore Since Sitecore 4.1.

Add a UserAgent to the IHttpClientFactory in .NET Core

Using a IHttpClientFactory to create HttpClient connections have a number of advantages, as you can configure several httpclients on startup. Each client will be reused, including the properties attached to that client. In a previous post I showed how to … Continue reading

Posted in .net, .NET Core, c# | Tagged , , | Leave a comment

Sending JSON with .NET Core QueueClient.SendMessageAsync

You need to Base64 encode JSON serialized strings before adding them to a queue Continue reading

Posted in .NET Core, c#, General .NET, Microsoft Azure | Tagged , , , | Leave a comment

Sitecore Publish item when moved or dragged using uiMoveItems and uiDragItemTo pipelines

Sometimes you have items that needs to be published immediately if moved to a new location in the content tree. Sitecore supports this – of course – via the uiMoveItems and uiDragItemTo pipelines. This technique really applies to whatever you … Continue reading

Posted in c#, Sitecore 6, Sitecore 7, Sitecore 8, Sitecore 9 | Tagged , , , | Leave a comment

Run tasks in parallel using .NET Core, C# and async coding

If you have several tasks that can be run in parallel, but still need to wait for all the tasks to end, you can easily achieve this using the Task.WhenAll() method in .NET Core. Imagine you have this imaginary method … Continue reading

Posted in .NET Core, c# | Tagged , , , | Leave a comment

Using full Lucene Query Syntax in Azure Search

The Azure Cognitive Search is the search engine in Microsoft Azure. You can search using a simple queries (default) which is good at doing full text searches, or you can use full syntax which is a Lucene query syntax. The … Continue reading

Posted in .NET Core, Microsoft Azure | Tagged , , , , | Leave a comment

Sitecore field level Security – give write access to members of a certain group

The Sitecore security model is pretty straight forward, but as everything security, it can become complicated. This goes for field level security. For a certain field, I wish to grant read access to everyone, but write access only to members … Continue reading

Posted in Sitecore 6, Sitecore 7, Sitecore 8, Sitecore 9 | Tagged , , | Leave a comment

Method not found: ‘Void Sitecore.ContentSearch.Diagnostics.AbstractLog.SingleWarn(System.String, System.Exception)’.

I struggled with this error in my development environment: Method not found: ‘Void Sitecore.ContentSearch.Diagnostics.AbstractLog.SingleWarn(System.String, System.Exception)’. at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, … Continue reading

Posted in .net, c#, Sitecore 8, Sitecore 9 | Tagged , , | Leave a comment

C# Set local folder for .net Core Windows Services

When developing .NET Core Worker Services, you can allow the service to run as Windows Service: The side effect is that the root folder changes from the local folder to the System32 folder, which means that any log files that … Continue reading

Posted in .NET Core, c# | Tagged , , | 1 Comment

Manipulating XML Google Merchant Data using C# and LINQ

Receiving a Google Merchant Data feed (also known as a Google Product Feed) can be fairly easily manipulated on import time using a little C# and LINQ. The feed is basically a XML RSS 2.0 feed with some added properties … Continue reading

Posted in .net, .NET Core, c#, General .NET | Tagged , , , , , | Leave a comment

C# Azure TelemetryClient will leak memory if not implemented as a singleton

I noticed that my classic .net web application would leak memory after I implemented metrics for some background tasks. Further investigation showed that my MetricAggregationManager would not release its memory. Since one of the major changes was the implementation of … Continue reading

Posted in .net, .NET Core, c#, General .NET, Microsoft Azure | Tagged , , , | Leave a comment