Runar Ovesen Hjerpbakk

Science-based software development

Error RZ3007 - Targeted tag name cannot be null or whitespace.

The first release candidate of ASP.NET Core 2.1 is out with a lot of performance improvements and  new features. 

One of the features is Razor compilation on build, enabling catching more errors at design time and improved startup time. This however broke one of my apps.

After updating the app to 2.1, navigating to a Razor view met me with the following error:

Microsoft.AspNetCore.Mvc.Razor.Compilation.CompilationFailedException: One or more compilation failures occurred:
(0,0): Error RZ3007: Targeted tag name cannot be null or whitespace.
   at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CompileAndEmit(String relativePath)
   at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.OnCacheMiss(String normalizedPath)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Razor.Internal.DefaultRazorPageFactoryProvider.CreateFactory(String relativePath)
   at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.CreateCacheResult(HashSet`1 expirationTokens, String relativePath, Boolean isMainPage)
   at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.OnCacheMiss(ViewLocationExpanderContext expanderContext, ViewLocationCacheKey cacheKey)
   at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.LocatePageFromViewLocations(ActionContext actionContext, String pageName, Boolean isMainPage)
   at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.FindView(ActionContext context, String viewName, Boolean isMainPage)
   at Microsoft.AspNetCore.Mvc.ViewEngines.CompositeViewEngine.FindView(ActionContext context, String viewName, Boolean isMainPage)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.FindView(ActionContext actionContext, ViewResult viewResult)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
   at Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeResultAsync(IActionResult result)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResultFilterAsync[TFilter,TFilterAsync]()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResultExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeResultFilters()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at MediaServer.Startup.<>c__DisplayClass5_0.<<Configure>b__0>d.MoveNext() in /Users/sankra/projects/MediaServer/MediaServer/Startup.cs:line 104
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware:Error: An unhandled exception has occurred while executing the request.

Read More

Jekyll error - bad Request-Line

I use the excellent Jekyll to create this and a couple of other websites. Jekyll is a static website generator written in Ruby and plays very nicely with GitHub Pages.

But since it’s software, after all, it too needs updating once in a while. And as you know dear readers, all software sucks.

So I updated jekyll and other needed gems and tried to serve the page locally:

$ bundle exec jekyll serve --drafts --watch --baseurl '' --config _config.yml,_config-dev.yml --limit_posts 10
Configuration file: _config.yml
Configuration file: _config-dev.yml
            Source: /Users/hjerpbakk/projects/
       Destination: /Users/hjerpbakk/projects/
 Incremental build: disabled. Enable with --incremental
                    done in 12.903 seconds.
 Auto-regeneration: enabled for '/Users/hjerpbakk/projects/'
    Server address:
  Server running... press ctrl-c to stop.
[2018-03-20 16:40:31] ERROR bad Request-Line `\x16\x03\x01\x00?\x01\x00\x00?\x03\x03?t&,?\x1E??\x1AJmc?_?U??c\x00<'.
[2018-03-20 16:40:31] ERROR bad Request-Line `\x16\x03\x01\x00?\x01\x00\x00?\x03\x03aS?PP???c?\x1Ab~?K'\x13\b\x00w????M?8?\x7FK/\x00\x00.?,?+?$?#?'.
[2018-03-20 16:40:31] ERROR bad URI `?'.
[2018-03-20 16:40:31] ERROR bad Request-Line `\x16\x03\x01\x00?\x01\x00\x00?\x03\x03?~F?Еs''?ʓ???\x16??e?#\b?\x05a+?{\x18ܬ\x00\x00(?,?+?$?#?'.
[2018-03-20 16:40:31] ERROR bad Request-Line `\x16\x03\x01\x00?\x01\x00\x00?\x03\x03 ?<\x18J3z??{?\x03?KĘ*?\r??`"+y"L?F??P\x00\x00.?,?+?$?#?'.
[2018-03-20 16:40:31] ERROR bad URI `?'

Bad request lines as far as the eye can see.

Read More

.dockerignore is your friend

While working on a particular project built with a multi-stage Dockerfile I got this error:

Step 13/19 : RUN dotnet test "./DashboardServerTests/DashboardServerTests.csproj" -c Release --no-restore
 ---> Running in ac850e55464c
Build started, please wait...
/usr/share/dotnet/sdk/2.0.3/Sdks/Microsoft.NET.Sdk/build/Microsoft.PackageDependencyResolution.targets(323,5): error : Assets file '/Users/sankra/projects/DashboardServer/Grafana/obj/project.assets.json' not found. Run a NuGet package restore to generate this file. [/source/Grafana/Grafana.csproj]

Read More

Running ASP.Net Core web app in a Docker container using a multi-stage Dockerfile

Lately. I’ve written multiple web applications with ASP.Net Core. Together with C# newfound cross-platformness, this stack is a joy to work with.

I user Docker to run the applications, some in Azure, some on on-premise Linux boxes. This has thought me a couple of things. Firstly, the app should be built from within a container using a multi-stage Dockerfile.

Read More

Xamarin iOS bindings for Simulator Status Magic

Screenshots are an important aspect of App Store marketing. Not only do they promote the functionality and design of your app, but they can also reveal your attention to detail. Or lack thereof.

Many developers do not care how the battery, time and signal strengths are displayed in their screenshots. But I do.

Read More

An assembly specified in the application dependencies manifest was not found

This happened a while ago, but might be relevant again in the future.

I created a website using ASP.Net Core and ran it through a Docker Container.

$ docker run kitchen-responsible

Worked perfectly for a long time, but after updating a nuget package it started to fail with:

  An assembly specified in the application dependencies manifest (KitchenResponsibleService.deps.json) was not found:
	package: 'Microsoft.AspNetCore.Antiforgery', version: '2.0.1'
	path: 'lib/netstandard2.0/Microsoft.AspNetCore.Antiforgery.dll'
  This assembly was expected to be in the local runtime store as the application was published using the following target manifest files:

Read More

Visual Studio Code failed to start on macOS

One day Visual Studio Code (VS Code) did not start on my Mac.

Read More

Sorry, but there is no formatter for 'xml'-files installed.

Sometimes I question my sanity.

I’ve used Visual Studio Code (VS Code) since it was revealed at Build. One of its many useful features is the ability to format documents in a human readable form. This includes XML.

Or so I thought.

Read More

Get milliseconds from Unix epoch in C#

I needed a method in C# to get the number of milliseconds since the start of Unix time.

Unix time (also known as POSIX time or UNIX Epoch time) is a system for describing a point in time, defined as the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970, minus the number of leap seconds that have taken place since then.

This is the DateTime extension method I came up with:

public static long MillisecondsFromUnixEpoch(this DateTime dateTime) =>

Read More

Split a C# list or array into multiple parts

I needed a method in C# to split a list or an array into multiple parts for batch processing. This is the IEnumerable extension method I came up with:

public static IEnumerable<IEnumerable<T>> Batch<T>(this IEnumerable<T> collection, int batchSize)
var nextbatch = new List<T>(batchSize);
foreach (T item in collection)
if (nextbatch.Count == batchSize)
yield return nextbatch;
nextbatch = new List<T>(batchSize);

if (nextbatch.Count > 0) {
yield return nextbatch;

Read More