Rash thoughts about .NET, C#, F# and Dynamics NAV.

"Every solution will only lead to new problems."

Category Dynamics NAV 2013

Monday, 12. May 2014

Weird floating point arithmetic in Dynamics NAV 2013 R2

Filed under: Dynamics NAV 2009,Dynamics NAV 2013,Navision — Steffen Forkmann at 13:42 Uhr

At the moment we are porting one of our products from Dynamics NAV 2009 R2 (Classic Client) to NAV 2013 R2. We have thousands of unit tests and most of them work out of the box.
But now my colleague Matthias Schäfer found a very strange issue. Consider this snippet:

On Dynamics NAV 2009 R2 Classic client (Build 6.00.33494) we get the same message twice:

Dynamics NAV 2009 R2

But on Dynamics NAV 2013 R2 (Build 7.10.36281) we get:

Dynamics NAV 2013 R2

Dynamics NAV 2013 R2

Weird, isn’t it?

Update 1

This is what the Dynamics NAV compiler is emitting:

We assume this is what the Dynamics NAV compiler should do:

Wednesday, 18. December 2013

Microsoft Dynamics NAV type provider

Filed under: Dynamics NAV 2009,Dynamics NAV 2013,F#,Navision — Steffen Forkmann at 14:34 Uhr

In earlier posts I showed how we can use F# type providers to access Dynamics NAV 2009 via Web Services and Dynamics NAV 2013 via OData. This time I want to point to a new type provider which allows Dynamics NAV data access directly via the SQL Server. The new type provider aims to be a replacement for C/Front.NET and gives a much nicer API.

alt text

It’s already available on nuget and has documentation with a “getting started guide”.

Tags: , ,

Monday, 8. April 2013

Stati-C/AL Prism – Static analysis for Microsoft Dynamics NAV reloaded

Filed under: Dynamics NAV 2013,F#,Navision — Steffen Forkmann at 9:07 Uhr

Christian Clausen and Bent Rasmussen released their second static analysis tool for Dynamics NAV called Prism. This time it has more features and it’s even faster than Supervision.

“Load time for Developers Toolkit for a typical full database is approximately 25 minutes which compares to Prism’s 20 seconds. Load time is a serious productivity and/or quality killer, as people will either work with old objects in Developers Toolkit, wait another 25 minutes to reprocess the objects, or even decide to just go ahead and change code without understanding how the current code is actually working.”

[project page]

The biggest new feature is “Find usages”:


Check out the project page and watch the presentation at the Community for F# which gives some details about the implementation.

Tags: ,

Friday, 5. April 2013

Stati-C/AL Supervision – blazing-fast static analysis for Microsoft Dynamics NAV

Filed under: Dynamics NAV 2009,Dynamics NAV 2013,F#,Navision — Steffen Forkmann at 17:26 Uhr

Until yesterday I thought I would be the only person on this planet who plays with a combination of F# and Dynamics NAV. Turned out I was wrong. Smiley

Christian Clausen and Bent Rasmussen created a really really cool static analysis tool for Dynamics NAV written in F#. For those who worked with the Dynamics NAV Developer’s Toolkit this is your new friend:


“Supervision is a free software program which can transform C/AL object text files into color-coded hyper-linked interactive HTML files.

The purpose of Supervision is to give Microsoft Dynamics NAV developers an easy and intuitive way to browse C/AL source code which provides better insight into the semantics of C/AL programs.”

[Project page]

Some of the features are:

  • Produces HTML/JavaScript code from Microsoft Dynamics NAV text export files
  • Usages of user-defined functions, variables, parameters, fields, system-defined variables, and object types link to their declaration
  • Usages of C/AL system functions link to official Microsoft C/AL language documentation
  • Code coloring
  • It’s blazing-fast Zwinkerndes Smiley

Check out the project page and watch the presentation at the Community for F# which gives some details about the implementation.

Tags: , ,

Sunday, 6. January 2013

Bug in Microsoft Dynamics NAV 2013 OData services?!

Filed under: C#,Dynamics NAV 2013,Navision,Visual Studio — Steffen Forkmann at 10:24 Uhr

The “Walkthrough: Creating and Interacting with a Page Web Service (OData)” shows how we can easily access Dynamics NAV OData from the default company:

But somewhere in this process there seems to be a bug. If I want to access data from a different company I get a timeout:

I found a workaround for this, but if anybody knows more about this please write a comment.

Tags: , ,

Friday, 4. January 2013

F# and Microsoft Dynamics NAV 2013 OData Services

Filed under: C#,Diverses,Dynamics NAV 2009,Dynamics NAV 2013,F#,Visual Studio — Steffen Forkmann at 13:52 Uhr

In my last post I described how we can access Dynamics NAV 2009 SOAP web services from F# and the benefits we get by using a type provder. Since version 2013 it’s also possible to expose NAV pages via OData. In this article I will show you how the OData type provider which is part of F# 3 can help you to easily access this data.

Exposing the data

First of all follow this walkthrough and expose the Customer Page from Microsoft Dynamics NAV 2013 as an OData feed.

Show the available companies

Let’s try to connect to the OData feed and list all available companies. Therefore we create a new F# console project (.NET 4.0) in Visual Studio 2012 and add references to FSharp.Data.TypeProviders and System.Data.Services.Client. With the following snippet we can access and print the company names:

As you can see we don’t need to use the “Add Service Reference” dialog. All service type are generated on the fly.

Access data within a company

Unfortunately Dynamics NAV 2013 seems to have a bug in the generated metadata. In order to access data within a company we need to apply a small trick. In the following sample we create a modified data context which points directly to a company:

Now we can start to access the data:

As you can see this approach is very easy and avoids the problem with the manual code generation. If you expose more pages then they are instantly available in your code.

As with the Wsdl type provider you can expose the generated types from this F# project for use in C# projects.

Further information:

Tags: , , ,