Skip to main content

Posts

WSFederation OWIN - Could not load type 'System.IdentityModel.Tokens.TokenValidationParameters' from assembly 'System.IdentityModel.Tokens.Jwt, Version=5.0.0.127, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

At one of my clients we are (still) using ASP.NET MVC 5 and Web API 2. To secure these web applications we use the WSFederation OWIN middleware together with ADFS. This combination works nice and helps us keeping our applications secure. Today one of the teams contacted me and complained that the middleware no longer worked. The error message they got looked like this: Could not load type 'System.IdentityModel.Tokens.TokenValidationParameters' from assembly 'System.IdentityModel.Tokens.Jwt, Version=5.0.0.127, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The root cause of the problem could be found in the version number, they accidently upgraded the System.IdentityModel.Tokens.Jwt assembly from version 4 to 5. It turns out that version 5 is no longer compatible with OWIN. After reverting back to version 4, everything returned back to normal…

TFS 2017 Build- MSTest v2 tests are not recognized

After upgrading our unit tests to MSTest v2 we noticed that our tests were no longer discovered by the VSTest task on our build agent. As a solution, we decided to invoke the test execution ourself. Therefore I added 2 tasks to our Build definition: One command line task to execute dotnet test One task to collect and publish the test results In the command line task I configured the following settings: To execute the dotnet command we specify ‘dotnet’ as the Tool We also specify the following arguments: test: we want to execute the test commando --no-restore: the package restore already happened in a previous build step and shouldn’t be re-executed here --no-build: assembly compilation already happened in a previous build step and shouldn’t be re-executed here --logger:trx: output the test results in the trx format A last important setting that we change is the ‘Continue on error’ setting is set to true. If we don’t do t...

Designing, building, and operating microservices on Azure

Perfect reading material for during the Christmas holidays! Microsoft released some new material together with a reference implementation on how to build a microservices application on top of the Azure platform. Microservices have become a popular architectural style for building cloud applications that are resilient, highly scalable, and able to evolve quickly. To be more than just a buzzword, however, microservices require a different approach to designing and building applications. In this set of articles, we explore how to build and run a microservices architecture on Azure. Topics include: Using Domain Driven Design (DDD) to design a microservices architecture. Choosing the right Azure technologies for compute, storage, messaging, and other elements of the design. Understanding microservices design patterns. Designing for resiliency, scalability, and performance. Building a CI/CD pipeline.

VS Code–Import Cost extension

The more I use VS Code, the more I love it. It is fast and offers an ever growing list of great extensions. One of the extensions I added recently is the Import Cost Extension . From the documentation : This extension will display inline in the editor the size of the imported package. The extension utilizes webpack with babili-webpack-plugin in order to detect the imported size.   On one of the Angular projects I’m working I saw our (minified) vendor.bundle.js file growing to 8MB(!) in size. People were importing any library they found useful without being aware of the extra cost it introduces. With the help of the Import Cost extension, you see the cost early and maybe think twice before you import another library. I’m a fan! More information: https://hackernoon.com/keep-your-bundle-size-under-control-with-import-cost-vscode-extension-5d476b3c5a76

Angular–CompareWith

Angular 4 introduces a new directive that helps you compare select options. This directive is especially useful when your select options are dynamically populated. Let’s explain why… Here is a sample component that contains a dropdown with some options: We set the default option by passing the object reference through the FormControl constructor. Problem is now that when we repopulate our options list(for example through an HTTP call), the object reference is gone and the model binding of our selected value is lost. To solve this problem we can use the compareWith directive which will no longer compare the object references but uses a boolean expression or function instead:

Error CS1525: Invalid expression term 'throw'

On our build server we noticed that one of our builds failed with the following error message: Error CS1525: Invalid expression term 'throw' When building the project locally in Visual Studio, we had no errors ? We found a solution here that worked for us as well: Update Microsoft.Net.Compilers to 2.0.1 or greater. We did an Update-All of the NuGet package at the solution level after which the error disappeared…

Create a .npmrc file on Windows

Kind of stupid but Windows doesn’t like it when you try to create a file with only an extension(like .gitignore, .npmrc,…). Windows will give you an error message instead: The trick to get it working is to include an ending dot also, like .npmrc. Don’t ask me why it works…