Tuesday, October 25, 2016

WIF error: ID4175: The issuer of the security token was not recognized by the IssuerNameRegistry.

I’m currently working on a training for one of my customers covering WIF(Windows Identity Foundation),  OIDC(Open ID Connect) and some other security related topics on top of the .NET stack.

Yesterday I got a strange problem after configuring the MVC application that should act as the relying party.

Here is the WIF specific configuration:

And here is the error I got when I ran the application:

ID4175: The issuer of the security token was not recognized by the IssuerNameRegistry. To accept security tokens from this issuer, configure the IssuerNameRegistry to return a valid name for this issuer.

I compared the thumbprint of the certificate used by the STS with the thumbprint inside the config:

         <add thumbprint="6b 7a cc 52 03 05 bf db 4f 72 52 da eb 21 77 cc 09 1f aa e1" />


No matter how much I looked, I couldn’t see a difference.

Time to ask the global web for help. After some research I found the following article: https://support.microsoft.com/en-us/kb/2023835

It seems there is a bug in the Richedit control that is used by the Certificate UI. When you copy the thumbprint, an extra (invisible) unicode character is being copied also. And indeed when I typed it in instead of copying it over, the error disappeared… Confused smile

Monday, October 24, 2016

VSTS: Monitor usage

Last week I discovered a new tab inside VSTS; the Usage tab.


The Usage tab shows the request history of the users ordered by usage( based on Team Services Throughput Units  or TSTUs). By default, visiting the Usage page will display requests for the last hour.


Another nice feature is that you can review the request history leading up to delayed requests.


Friday, October 21, 2016

Xamarin.Forms: INSTALL_FAILED_UPDATE_INCOMPATIBLE when trying to deploy to Android device

When we tried to deploy a Xamarin Forms app to an Android device, we got the following error:

InternalError ---> Mono.AndroidTools.InstallFailedException: Failure
at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName)
at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass2a.<InstallPackage>b__29(Task`1 t)
at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of inner exception stack trace ---
at Xamarin.AndroidTools.AndroidDeploySession.RunLogged(CancellationToken token)
at Xamarin.AndroidTools.AndroidDeploySession.Start(CancellationToken token)

The problem seemed to be that a "ghost" copy of the app still existed on the device although there was no app icon. However when searching under Applications we found it with its package name instead.

After uninstalling the package we were able to deploy the new version…

Thursday, October 20, 2016

The Open Guide to Amazon Webservices

I hear people talk about JavaScript fatigue, the constant churn of new frameworks, tools and libraries in the JavaScript ecosystem makes it difficult to keep up. I must say that I have the same feelings regarding Cloud, every week Microsoft, Google or Amazon announce a new PaaS, SaaS, FaaS,… offering.

A great resource to help you understand what’s going on inside the Amazon cloud space, is the Open Guide to Amazon Webservices.

From the github page:

A lot of information on AWS is already written. Most people learn AWS by reading a blog or a “getting started guide” and referring to the standard AWS references. Nonetheless, trustworthy and practical information and recommendations aren’t easy to come by. AWS’s own documentation is a great but sprawling resource few have time to read fully, and it doesn’t include anything but official facts, so omits experiences of engineers. The information in blogs or Stack Overflow is also not consistently up to date.

This guide is by and for engineers who use AWS. It aims to be a useful, living reference that consolidates links, tips, gotchas, and best practices. It arose from discussion and editing over beers by several engineers who have used AWS extensively.


Wednesday, October 19, 2016

NHibernate Issue: Unexpected updates are triggered

A colleague came to me with the following NHibernate problem; he loads some data from the database using the QueryOver syntax. Although he doesn’t do anything else with the data, NHibernate detects that the list is changed and tries to flush the changes to the database.

What’s causing NHibernate to think that an item has changed?

We figured out the reason after some investigation.

Inside our database we have nullable column e.g.:

Age [int] NULL  -- Nullable column

But inside the mapping we decided to map it to a not nullable property:

<property name="Age" />

public virtual int Age { get; set; }

The moment that the data is loaded and NHibernate sees a null value for Age, inside the property it will be set to 0(the default value for an int).

As the value has changed, NHibernate will detect this and tries to flush the change afterwards.

The solution is to make the property nullable:

public virtual int? Age { get; set; }

Tuesday, October 18, 2016

Testing your Akka.NET system using EventFilter

Although Akka.NET has built-in support for testing, it is sometimes hard to find out what’s really going on inside your actor system.

A useful feature that can help you solve this problem during integration testing is the EventFilter. The EventFilter is a tool to verify that actors write certain log messages. It can also detect if messages go to DeadLetters and if certain exceptions are thrown.

2 examples:

Remark: By default the event filter searches for exact matches.

Monday, October 17, 2016

TypeScript 2.0–Fixing the million dollar mistake

With the introduction of TypeScript 2.0 one of the biggest root causes of bugs in software development finally got a solution. TypeScript 2.0 adds the ability to treat every type as non-nullable.

Let’s see how this works!

Installing TypeScript 2.0

Before we can check out the new language feature, we first have to install TypeScript 2.0. At the moment of writing it didn’t appear yet as part of my Tools and Extensions Updates inside Visual Studio, so let’s go to the TypeScript website and download the code from there.

Take the editor of your choice and install the required package.


Enable Strict null checking in Visual Studio

After installing TypeScript 2.0, strict null checking is not enabled out of the box. An extra compiler flag (—strictNullChecks) is required to switch to strict null check mode. To enable it in Visual Studio, you should unload your csproj file, edit it and add the following line to a propertygroup:


Strict null checking; what does it mean?

From the release notes:

TypeScript has two special types, Null and Undefined, that have the values null and undefined respectively. Previously it was not possible to explicitly name these types, but null and undefined may now be used as type names regardless of type checking mode.

The type checker previously considered null and undefined assignable to anything. Effectively, null andundefined were valid values of every type and it wasn’t possible to specifically exclude them (and therefore not possible to detect erroneous use of them).

In strict null checking mode, the null and undefined values are not in the domain of every type and are only assignable to themselves and any (the one exception being that undefined is also assignable to void).

Ahum? Yes, OK. Let’s try to rephrase this, before null and undefined were always valid values applicable everywhere. Problem was that the compiler couldn’t make any intelligent suggestions the moment null or undefined came into the picture. By switching to strict null checking mode, null and undefined can only be assigned to types that are explicitly flagged as nullable.

An example:

Without strict null checking the following code will compile:

With strict null checking we get a compiler error instead:


More information: