Friday, August 26, 2016

AADSTS50001: The application named was not found in the tenant named .

Today we lost some investigating why we couldn’t authenticate a WinForms app using ADAL to Azure AD.

Here is the code we were using:

And here is the exception we got:

AADSTS50001: The application named .onmicrosoft.com/sample">https://<resource>.onmicrosoft.com/sample was not found in the tenant named <tenant>.onmicrosoft.com.  This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant.  You might have sent your authentication request to the wrong tenant.

Trace ID: a1b52908-f2c8-4f9d-aabb-e0050ff9ca0c

Correlation ID: 9f0ec9de-2f32-47b2-9d25-11333b2bd1d6

Timestamp: 2016-08-26 10:22:17Z

If you see the error above, triple check your configuration values. Almost all the time this means you have a typo somewhere causing Azure not to find the correct information. In our situation we had a typo in the APP ID URI… Confused smile

image

Thursday, August 25, 2016

ASP.NET Web API: Remove XML formatter

ASP.NET Web API supports the concept of media formatters. Based on the content-type you set in your request headers different output can be generated. Default formatters exist for XML and JSON.

However I had a situation where I only wanted to return JSON output. Removing the XML formatter can easily be done through the Web API configuration inside your startup.cs file:

Wednesday, August 24, 2016

Web.config transformations: How to update an appsetting value

Web projects in Visual studio support the concept of web.config transformations, making it easy to update your configuration depending on the build you are using.

image

Yesterday I had a hard time to remember what the exact syntax was to update a specific appsetting. So here is a small snippet to help me remember:

Tuesday, August 23, 2016

TFS–User \ needs the 'ManageBuildResources' permission to add, update, or delete the build resources on the server.

When trying to install and configure a XAML Build controller I got the following error during the validation step:
User <domain>\<username> needs the 'ManageBuildResources' permission to add, update, or delete the build resources on the server.
Ok, no problem. I know that to configure the XAML Build and link it to a specific collection you need to be part of the Project Collection Administrators or Project Collection Build Administrators group. So I opened up the TFS Administration Console, browsed to the Collection where I want to add a build controller and clicked on Group Membership. The Global Groups window is loaded and here I can add the user(Click on Properties… –> Add).
image
Unfortunately this didn’t solve the problem. Although I had added the user to the correct groups, the error keeps appearing…
However when I added the user to the same groups through the web portal, it did work. Strange!

  • Open the Web Portal
  • Go the Administration site
  • Select the Collection level
  • Go to the Security tab
  • Select the Project Collection Administrators group
  • Click on Members and add the user

image

Monday, August 22, 2016

Team Foundation Server Administration Console: Index is out of bounds.

Got an email this morning from a customer asking me if I had seen the following error message before when opening the XAML Build Configuration inside the  TFS Administration Console:

“Index 10985 is out of bounds.”

image

This is an error I had never seen before. The thing is that the system itself was working as expected.

I asked to take a look at the logs. There we noticed that an enormous amount of event messages were generated. Could this be causing the issue?

And indeed after we cleared the event log, the XAML Build configuration appeared again. On the screen some Events related data is shown, probably this couldn’t handle the large load of messages…

image

Friday, August 19, 2016

Telerik WPF controls: XAML vs NoXAML

On a WPF project we are using the WPF controls from Telerik. Inside the Telerik folder we noticed that their are actually 2 versions of the binaries available; a ‘normal’ and a NoXaml version.

So what’s the difference and which one should I choose?

The normal assemblies contain some components together with a default set of styles and ControlTemplates. As most assemblies contain multiple components this can start to add up, as styles and templates for every component are provided. This also means that some of these assemblies are big.

To decrease the file size, a NoXaml version of the assemblies was created including only the components themselves but no xaml code(styles, brushes, controltemplates,…). However as the NoXaml version doesn’t contain any visualization information, using these alone will not make much sense. No visual output will be rendered on the screen. A NoXaml dll should therefore always be combined with a theme dll.

So which one should you pick? If you are only using a small set of components and filesize is important to you, use the NoXaml version. Otherwise you can use the ‘normal’ assemblies.

Remark: If you further want to decrease the file size, you can also decide to not use a theme dll but copy the XAML themes from the Themes.Implicit folder to your project. This allows you to remove all styling you don’t use and keep only what’s relevant.

Thursday, August 18, 2016

Akka.NET TestKit–No tests found to run.

I’m currently working on a project where I’m using Akka.NET and the Actor model. I’m amazed by the ease-of-use and how the actor model itself makes complex problems easy to implement. Anyway, I lost some time today investigating a problem that a colleague had. After installing TestKit and writing his first actor based unit test, the Test Runner explorer refused to work and the only output we got was:

No tests found to run.

image

After a few minutes I realized our mistake, we downloaded the Akka.TestKit.NUnit which is suitable for NUnit 2 and older. However we are using NUnit3, which requires a different NuGet package; Akka.TestKit.NUnit3.  After installing the correct NuGet package, our tests appeared and the problem was gone.

Kind of stupid to stumble over this problem because I had the same issue before (and even mentioned it explicitly in a previous blog post about Akka.NET; http://bartwullems.blogspot.be/2016/07/testing-your-akkanet-actors-using.html) Confused smile