Rico Suter's blog.
 

Articles

SystemJS module loader: Enable JavaScript debugging with Visual Studio and Internet Explorer

In a project, we switched from the JavaScript module loader RequireJS to SystemJS. After the migration, debugging JavaScript directly from Visual Studio in Internet Explorer stopped working. The problem is that Visual Studio cannot detect the loading of script files because SystemJS uses JavaScript HTTP calls instead of injected tags to load modules.
Read More ›

How to programmatically retrieve the deployment time of an ASP.NET web site

In one of my web projects, I wanted to append the web site deployment time to the JavaScript URLs. This way the browser uses the cached file version until a new web site version is deployed.
Read More ›

OpenLayers 3: Add the Bing Maps Traffic layer to your map

The following code shows how to add the Bing Maps Traffic layer to your OpenLayers 3 map.
Read More ›

JavaScript decorator to add pre- and post-logic to a Promise

In this blog post, I’ll describe the simple concepts of JavaScript Promise decorators. They are a simple way to add logic which is run before and after the exection of a Promise (a.k.a. aspect-oriented programming). As soon as you see my two samples, you’ll get the idea…
Read More ›

Asynchronously loaded Unit Tests with Jasmine and RequireJS

The following check list shows how to write JavaScript Jasmine Unit Tests where the tests are asynchronously loaded from AMD modules with RequireJS.
Read More ›

Angular: Convert input values to the correct type with a TypeScript property decorator

I recently played with Angular and found an uncomfortable problem: Declaring an input property with a TypeScript type does not guarantee that the input value will always be of this type. This is because the Angular framework may update an input with a wrongly typed value and thus is able to “circumvent” the TypeScript type system. As a result, you may end up with strange and unexpected runtime errors.
Read More ›

Migrate a TFS repository to a Azure DevOps Git repository

To migrate a TFS repository to a Azure DevOps Git repository, just perform the following steps.
Read More ›

JavaScript Promises: Tips, tricks and best practices

JavaScript Promises are a very powerful tool to avoid the callback nesting hell. The following article describes some tips and tricks when working with Promises. For developers with C# async/await knowledge, I will also show the async/await representations. With TypeScript, you can use this async/await syntax today.
Read More ›

Inside Async/Await: Synchronize an async method or code block

Have you ever tried to await a task inside a lock() block? It is not possible, because you can only synchronize synchronous code with the lock keyword. However, in today’s .NET development, async/await is used everywhere and the need to synchronize asynchronous code blocks is coming up quite often. This is why I wrote a simple class which can be used to synchronize asynchronous code blocks.
Read More ›

Avoid wrongly scoped injections with a custom Ninject kernel

I’m currently working on a large project where different teams implement assemblies which are consumed by other teams. We use Ninject for dependency injection: Each assembly has a Ninject module class which registers the available interface-to-implemenation bindings. At the moment, the consumers of these assemblies just know what module classes to load and what interfaces to inject into own objects like ASP.NET controllers or own service objects, but nothing about the scope of the injected objects. Recently we had some nasty runtime errors, because a consumer of one of these assemblies injected a per-request scoped object into a singleton-scoped object. This is why I looked for a way to detect injections of wrongly scoped objects (also known as captive dependencies).
Read More ›