Skip to main content

Posts

Showing posts from April, 2014

Application Insights and Sharepoint: not a good combination

After installing the Application Insights Monitoring Agent on one of our Application Servers, users started to complain that the Sharepoint environment running on the same machine became very slow. When looking inside the Event Log on the server, we found a lot of errors similar to the following: Faulting application name: w3wp.exe , version: 7.5.7601.17514, time stamp: 0x4ce7afa2 Faulting module name: ntdll.dll, version: 6.1.7601.18247, time stamp: 0x521eaf24 Exception code: 0xc0000374 Fault offset: 0x00000000000c4102 Faulting process id: 0x10e8 Faulting application start time: 0x01cf4838c2e39a9a Faulting application path: c:\windows\system32\inetsrv\w3wp.exe Faulting module path: C:\Windows\SYSTEM32\ntdll.dll Report Id: 5fce3de2-b42c-11e3-9d78-005056924d03 The MSDN forums and the Connect site brought some answers to this issue and linked the issue to our recently installed Monitoring Agent. And indeed after removing the Monitoring Agent, th

MongoDB error: An error occurred while deserializing the _id field of class … : Cannot deserialize string from BsonType ObjectId.

The last few weeks I’m having fun learning MongoDB . Having some experience with RavenDB , I hoped to re-use most of knowledge when building a MongoDB backend. However I have to conclude that no two No-SQL solutions are alike, so there is still a high learning curve. I created a sample application, but when I tried to load some objects from the database, I got the following error: An error occurred while deserializing the _id field of class Product: Cannot deserialize string from BsonType ObjectId. Let’s have a look at the object I was using; I have a Product class with 2 properties and an ‘_id’ field. The ‘_id’ field is automatically generated by MongoDB for every object you create. The problem is that behind the scenes MongoDB is storing all objects as BSON documents in the database. The ‘_id’ field isn’t an ordinary string but an ObjectId , a 12-byte BSON type, constructed using: a 4-byte value representing the seconds since the Unix epoch, a 3-byte machine id

Impress your colleagues with your knowledge about... the gcServer config option

Sometimes when working with .NET you discover some hidden gems. Some of them very useful, other ones a little bit harder to find a good way to benefit from their functionality. One of those hidden gems that I discovered some days ago is the gcServer config option. What I didn’t know is that there are actually two kinds of Garbage Collectors available in .NET, the Workstation GC and the Server GC. From the MSDN site : The garbage collector is self-tuning and can work in a wide variety of scenarios. You can use a configuration file setting to set the type of garbage collection based on the characteristics of the workload. The CLR provides the following types of garbage collection: Workstation garbage collection, which is for all client workstations and stand-alone PCs. This is the default setting for the <gcServer> element in the runtime configuration schema. Workstation garbage collection can be concurrent or non-concurrent. Concurrent garbage co

Import a TFS 2008 collection in TFS 2012

With the change from TFS 2008 to TFS 2010, with the introduction of the TFS collections, Microsoft completely reorganized the database structure. This makes it impossible to just attach your TFS 2008 databases to an existing TFS 2010/2012 environment. You can not attach a collection as the concept of a collection didn’t exist yet in 2008. So how can we fix this? Luckily Microsoft did all the work for us and introduced a command line option in TFSconfig to import an old TFS 2008 database and attach it as a new collection. Export the TFS 2008 databases Import the databases to the database server that you use for your TFS 2012 instance Log on to your TFS 2012 application server Open a command prompt(run as an administrator) Go to the TFS tools directory: c:\program files\Microsoft Team Foundation Server 11.0\Tools Run the tfsconfig command with the following options: tfsconfig import /SQLInstance: <instancename> /CollectionName: <new collecti

.NET Universe Poster 2013

Looking for an overview of the .NET framework showing the main .NET SDKs, libraries and packages classified by application type and package type? Microsoft created the .NET Universe Poster(deserves a place in every developer’s bedroom ). From the download page : This poster shows how the trends are changing in .NET as we´re moving from a single large .NET Framework to a more loosely coupled and autonomous libraries and sub-frameworks, many of them even published as NuGet packages and evolving continuously. The number of those libs and packages is evolving and growing, so having a visual photo of it can be helpful. The main idea of the poster is to show that you can create any kind of application with .NET, from the largest applications to the smaller apps: in the cloud, on the web, on desktops, tablets, phones, and in embedded environments (even watches!). Any of those application types is shown as category/bucket in the poster and within each bucket we´re tossing the main libra

TFS Git: Sync button not enabled

For a project I’m using the TFS Git integration. After creating a local branch and committing some changes, I couldn’t sync my changes to the remote TFS repo. The ‘Sync’ button was disabled on the Unsynced Commits screen. The reason the ‘Sync’ button was disabled is that although I had the branch created locally, this branch didn’t exist yet on the remote TFS repo. I had to create this branch first. This is not possible from inside Visual Studio (yet). So you have to go to a command prompt and execute the following command to push the current branch and set the remote as upstream: git push --set-upstream origin new_branch

C# Brainteasers

Looking for some brain gymnastic before starting the weekend? Have a look at Sunny Ahuwanya's C# brain teaser: http://www.ahuwanya.net/blog/post/C-Brainteasers-Part-I http://ahuwanya.net/blog/post/C-Sharp-Brainteasers-Part-2 I have to admit that I had most of them wrong . It seems there are some dark corners and edge cases in C#… Go check them out!

MongoDB: System error 1067 has occurred.

After installing MongoDB as a windows service I wasn’t able to get it started. Instead the following error message was shown: The Mongo DB service is starting. The Mongo DB service could not be started. A system error has occurred. System error 1067 has occurred. The process terminated unexpectedly. When MongoDB crashes like this, you have to do some clean up work before trying to start it again: Delete the following file inside the /data/db/ directory: mongod.lock mongod.exe –repair Start the mongod service again

TypeScript error: Initializer of instance member variable cannot reference identifier declared in the constructor.

In a TypeScript application we are building, we have code similar to the following: However when we try to run this, TypeScript complains with the following error message: Error      19           Initializer of instance member variable 'processAllOrders' cannot reference identifier 'that' declared in the constructor.              I think it’s a bug in TypeScript as I don’t see any reason why this shouldn’t work.

Error in Visual Studio 2013 when creating a new project: “No exports were found that match the constraint"

After installing some updates, my Visual Studio went bananas. When I try to create a new project, it always fails with the following error message: No exports were found that match the constraint: ContractName Microsoft.VisualStudio.Text.ITextDocumentFactoryService RequiredTypeIdentity Microsoft.VisualStudio.Text.ITextDocumentFactoryService No idea what’s causing the issue, but I was able to fix the issue based on the workaround mentioned on the Connect site : Delete the ComponentModelCache folder at %AppData%\Local\Microsoft\VisualStudio\12.0.

Dojo: Esri.request is undefined

On a Single Page Application we are building, we use the ArcGIS API for JavaScript .  This API allows us to bring the power of the ArcGIS GIS functionality into our client application. The ArcGIS API for JavaScript is build on top of the popular Dojo toolkit . This means that we had to integrate Dojo inside our application. So we added a Dojo config file to our application: However when we ran the application and tried to load a Dojo module, it failed with the following error message: Esri.request is undefined It took us some time to figure out that the issue was related to one specific setting inside our DojoConfig; the async setting. If async is set to true, injected modules will be loaded when require is called. If async is not set, these modules are loaded immediately when dojo.js is loaded. So to fix it, we updated the Dojo config to:

The remote certificate is invalid according to the validation procedure

When calling an OData service from inside my ASP.NET MVC application, the call always fails with the following exception: The remote certificate is invalid according to the validation procedure The OData service I’m connecting to is available through HTTPS so I would guess that something is wrong with the SSL certificate. Let’s walk through the checklist: Hostname matches the name used in the certificate: OK Certificate is not expired: OK Encryption level is high enough: OK The full certificate chain is trusted: OK Mmm, strange. Everything seemed fine. And when I browsed to the OData service directly from the browser, I could get all the data as I would expect. In the end I figured out that I had to give the MVC application access to the private key of the certificate. Following steps fixed the problem: Export the certificate from the OData Service host(don’t forget to export the private key as well). Open MMC and load the Certificates snap-in

Nice Visual Studio Add-in: File nesting

File Nesting is a feature in Visual Studio that was available for a long time. It allows you to put multiple files together under one ‘root’ file. This is a feature you’ve certainly seen in WinForms(designer generated code and codebehind), ASP.NET WebForms(HTML page and codebehind) and so on… Unfortunately to use this feature yourself, you had to start editing the .csproj files yourself. Not the best way to start using a feature! Thanks to Mads Kristensen File Nesting plugin this is no longer necessary and you can easily nest any file under another file in Solution Explorer. What makes it even nicer, is that File Nesting also gives you the option to automatically nest based on file naming rules. You can then apply those rules to any files, folders or entire projects. Install the plugin through the Visual Studio Extensions or download it here: http://visualstudiogallery.msdn.microsoft.com/3ebde8fb-26d8-4374-a0eb-1e4e2665070c . Thanks Mads!

Free e-book: Cloud Design Patterns: Prescriptive Architecture Guidance for Cloud Applications

When you move your applications to the cloud, there are lot’s of new things you need to learn. But the cloud doesn’t only bring new challenges but also some great new opportunities. To help you get the most of each cloud platform, Microsoft released a free e-book, Cloud Design Patterns: Prescriptive Architecture Guidance for Cloud Applications , that introduces some Cloud Specific Design Patterns. It contains twenty-four design patterns and ten related guidance topics that articulate the benefits of applying patterns by showing how each piece can fit into the big picture of cloud application architectures. It includes code samples and general advice on using each pattern.

TypeScript: using dynamic properties

Although I really like static typing and the other great features that TypeScript brings to JavaScript, sometimes I just want to profit from the dynamic nature of JavaScript. I had a JavaScript/TypeScript object where I wanted to set a property value: In TypeScript, this generates an error: The property 'prop' does not exist on value of type '{}' To fix it, I had to add a type annotation:

Certificates snap-in: Where is the manage private keys option?

To setup a 2 way trust between my WCF service and (web) client I’m using SSL and X509 certificates. The problem was that I got the following exception on the client: CryptographicException 'Keyset does not exist'. I had this error before so I knew I had to give my application pool user access to the private key of the client certificate. So I opened MMC, loaded the Certificates snap in, right clicked on the certificate and saw… no ‘Manage Private Keys’ option . It took me some time to figure out that I had to add the Certificates snap-in using the "Computer account" option instead of the default "My user account" option . After doing that, the “Manage Private Keys” option was available:

F# series

Looking for a good introduction to F#? Have a look at the F# series by Sacha Barber, a great set of blog posts where he covers almost all aspects of what F# has to offer… F# 1 – Hello World F# 2 – FSI Environment F# 3  - Formatting text F# 4 – Let/use/do bindings F# 5 – Operators F# 6  - Tuples F# 7 – Records F# 8 – Discrimated Unions F# 9 – Option types F# 10 – Lists F# 11 – Sequences F# 12 – Arrays

OData: create a query using AddQueryOption

I got a question from a customer who wanted to create an ‘'IN” query(something like SELECT * FROM Address WHERE Postcode IN (2000, 1100, 1940, 1745) ). This is something you cannot do out-of-the-box using OData(not that I’m aware of). A possible alternative is using the AddQueryOption and build the filter condition yourself: Remark: This only works if the list of elements is rather small.