Is GitHub Copilot Any Good for Business Central Development?


No. At least, not yet.

Maybe later.

But even then, maybe not.


For now this is necessarily a simple, first impressions post about GitHub Copilot. I’ve used it for a few weeks, tweeted enthusiastically in the first couple of days’ use and have now disabled it. What is it, how does it work, what’s good, what’s not so good?

What is GitHub Copilot?

Your AI pair programmer. With GitHub Copilot, get suggestions for whole lines or entire functions right inside your editor.

Copilot is a service from GitHub, accessed through a Visual Studio Code extension which provides suggests for code and comments as you are typing.

How Does it Work?

I won’t pretend to know much about the inner workings of the extension but this is how I understand it. GitHub clearly have an enormous amount of open source code under their control for all manner of programming languages. They have used that code to train an AI model.

The Copilot VS Code extension takes your existing code and comments, feeds that to the model and attempts to predict what you might want to type next. The best suggestion shows up faintly beyond the cursor and you can tab to accept the suggestion. Alternatively you can load the top 10 suggestions and select the best one to insert into your code.

Some Examples

Below is an example where I have created a new procedure called ValdiateEmailAddress. We’ll ignore the obvious issues with the suggestions for now and just show it as an example of how the extension works.

ValidateEmailAddress exmaple

Given that I’ve called the new method ValidateEmailAddress the extension has generated (apparently generated and not just straight copied from an existing repo) the suggested code which I have accepted by pressing TAB each time.

Here’s another example. Let’s create a new CreateSalesOrder method and view the suggested solutions.

CreateSalesOrder example

A couple of interesting things to notice here. Most of the solutions attempt to do something with the Order Origin Code field. That’s the only other code in the file, so Copilot seems to be giving a lot of weight to that in the suggestions. Some of the suggestions use keywords from other languages: this, var and new.

More Context

Those are the sorts of examples that you’ll find in YouTube videos which are enthusiastic about Copilot. Enter a method name, type a short comment that describes what the code should do and Copilot automagically suggests an implementation for your method. Any examples that you are going to be impressed by are likely to be written in JavaScript, Ruby or Python, not AL. More about that later.

Perhaps an example where we provide more context is fairer. The below example is of writing an automated test. Notice that I already have a test to check that releasing a sales order without a certain field populated throws an error. I’m going to create another test to check the same behaviour for sales invoices.

Writing an automated test with Copilot

Copilot has a much better time of suggesting the code this time, following the pattern of the above automated test. Not only do all of the suggestions compile, but they are correct. Now we’re getting somewhere.

Yes, and no. I’m not knocking it – but all it is actually doing is copying the above test and replacing all instances of “order” with “invoice”. We can already do that in VS Code in a few keystrokes – much faster than messing around with Copilot.

That said, it does demonstrate that Copilot “learns” from the code that you’ve already written and can make repetitive work more efficient. I typically always start an automated test with Init(); and finish with one or more calls to the Assert codeunit. Copilot quickly starts suggesting those lines, even with appropriate comments in calls to Assert.AreEqual(). Hence my initial enthusiasm and tweet.


What’s the problem then? Why does Copilot keep suggesting code that doesn’t compile? The biggest problem is that Copilot just hasn’t seen enough AL to know what it should look like. The suggestions do improve if you give it more context and write blocks of code which are similar to something you’ve written before, but ultimately the model hasn’t been trained on enough AL code.

But wait? Isn’t the whole of the base app for the past few versions on GitHub now? That’s thousands of AL files. Yes, it is – but that is a few H20 molecules in a drop in GitHub’s ocean. At the time of writing there are fewer than 100 GitHub repos containing AL code and approximately 31K AL files (see here).

Sounds like a lot of files…until you compare it to other languages.

LanguageApprox. No. of Files
AL31 thousand
Python100+ million
Java200+ million
PHP600+ million
C1.2+ billion
JavaScript1.4+ billion

If you’re trying to solve a problem in JavaScript it is pretty certain that someone, somewhere writing open source code has solved it before. Copilot ought to be able to generate a range of sensible solutions. Whether you want those suggestions is another matter.

Pair Programming

GitHub describe Copilot as “Your AI pair programmer.” That’s nice. As long as you like pair programming with someone in your ear the whole time suggesting the next line or two that you should write – before you have time to think for yourself.

I think that’s been my biggest issue with it. When I speak to someone else about what I’m working on I usually want to talk bigger picture. Do I understand the requirements? How does this affect some existing functionality? How does this integrate with other apps that we are writing?

When I write a method declaration I want to give some thought to how I’m going to approach the implementation. When Copilot pops up with some suggested implementation invariably I get distracted reading it rather than thinking about what code to write myself. Even if they were good suggestions I’m not sure that I’d like that. The fact that most of the suggestions use syntax from another language and don’t even compile makes it even worse.


Copilot is an interesting concept and I’ve enjoying playing with it. There have definitely been some moments when I’ve been very impressed with the suggestions that it has made. There have been times when it has saved me time writing some repetitive code. Or code which changes predictably between lines. You could compare it to auto-fill in Excel. Give it a few examples to demonstrate how the value changes each row and then auto-fill as many rows as you need following the same pattern.

However, I pretty quickly found the annoyances outweighed the benefits. The novelty wore off and I realised I was less productive with Copilot than without it. Maybe the suggestions will improve over time. Then again, maybe AL is just too niche and we can’t expect it ever to work as well it does with JavaScript.

Presumably at some point Microsoft are going to monetise this, but I can’t see AL developers paying for it. For now the extension is going to remain installed, but disabled.

Dmitry has submitted a session at DynamicsCon about Copilot. If you found this interesting you should check it out. Maybe he’ll be more enthusiastic than me.

One thought on “Is GitHub Copilot Any Good for Business Central Development?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s