1. Describe the bug
The result of a test that calls ClearAssignments() on Microsoft's
Permissions Mock codeunit depends on how the test is started. The test
passes when it is run from the AL Test Tool page in the Business Central
web client. When the same test is run with the Extension Test Runner in
Visual Studio Code, it fails because the internal DotNet variable for
Microsoft.Dynamics.Nav.Runtime.PermissionTestHelper has not been
instantiated. The same failure can alternatively be reproduced with the
Microsoft AL CLI (al runtests).
The exception is raised inside Microsoft codeunit 131006 before any
application-specific business logic is executed. The problem was observed
after the Business Central environment and the Microsoft test libraries had
been updated to version 28.3.52162.53349. The test app targets Business Central
28.x and runtime 17.0.
The reproduction project has no dependency on a customer or partner
application. Its only direct dependency is Microsoft's Permissions Mock
application.
2. To Reproduce
Steps to reproduce the behavior:
- Use a Business Central 28.3.52162.53349 environment with the Microsoft test
libraries installed.
- Clone this repository and open the reproduction project in Visual Studio
Code.
- Download symbols from that environment.
- Compile and publish the
Permissions Mock Repro test app.
- Open the AL Test Tool page in the Business Central web client, add
codeunit 50100 PMR Permissions Mock Repro, and run test method
ClearAssignmentsWithoutPriorSetup. The test succeeds.
- Open the Testing view in Visual Studio Code and run the same test method
with the Extension Test Runner. The test fails in
Permissions Mock.ClearAssignments().
-
Alternatively, run the same method with Microsoft AL CLI 18.0.39.10160:
al runtests 50100 `
--testmethods ClearAssignmentsWithoutPriorSetup `
--project . `
--raw
The CLI test run fails with the same error.
codeunit 50100 "PMR Permissions Mock Repro"
{
Subtype = Test;
[Test]
procedure ClearAssignmentsWithoutPriorSetup()
var
PermissionsMock: Codeunit "Permissions Mock";
begin
PermissionsMock.ClearAssignments();
end;
}
The relevant dependency and target versions in app.json are:
{
"dependencies": [
{
"id": "40860557-a18d-42ad-aecb-22b7dd80dc80",
"name": "Permissions Mock",
"publisher": "Microsoft",
"version": "28.0.0.0"
}
],
"platform": "28.0.0.0",
"application": "28.0.0.0",
"runtime": "17.0",
"target": "Cloud"
}
3. Expected behavior
The test should produce the same result regardless of whether it is run from
the AL Test Tool page, the Extension Test Runner in Visual Studio Code, or the
Microsoft AL CLI.
PermissionsMock.ClearAssignments() should clear any existing permission
assignments and return successfully. Calling it before any assignments have
been made should be a valid no-op and should not require application code to
initialize an internal Microsoft DotNet variable.
4. Actual behavior
The test succeeds when it is run from the AL Test Tool page. When the same test
is run with the Extension Test Runner in Visual Studio Code, it fails
immediately in Permissions Mock.ClearAssignments() with the following error.
The alternative Microsoft AL CLI 18.0.39.10160 execution produces the same
failure:
No instance was created for a DotNet variable. Attempted to call Microsoft.Dynamics.Nav.Runtime.PermissionTestHelper.Clear in CodeUnit Permissions Mock: ClearAssignments
AL Callstack:
"Permissions Mock"(CodeUnit 131006).ClearAssignments line 2 - Permissions Mock by Microsoft version 28.3.52162.53349
Sanitized and translated excerpt from the confirmed AL CLI run:
Running tests in codeunit 50100...
Test hub connected.
TestRunnerHub connected.
Test run failed: Test run completed: 0 passed, 2 failed, 0 skipped.
Results:
FAIL ClearAssignmentsWithoutPriorSetup (1ms)
No instance was created for a DotNet variable. Attempted to call Microsoft.Dynamics.Nav.Runtime.PermissionTestHelper.Clear in CodeUnit Permissions Mock: ClearAssignments
AL Callstack:
"Permissions Mock"(CodeUnit 131006).ClearAssignments line 2 - Permissions Mock by Microsoft version 28.3.52162.53349
"PMR Permissions Mock Repro"(CodeUnit 50100).ClearAssignmentsWithoutPriorSetup line 4 - Permissions Mock Repro by Repro version 1.0.0.0
The message states that no instance was created for the DotNet variable before
Microsoft.Dynamics.Nav.Runtime.PermissionTestHelper.Clear was invoked. The
difference between the execution paths suggests that the AL Test Tool page
initializes the permission test helper, while the Extension Test Runner and AL
CLI execution paths do not.
5. Versions:
- AL Language: 17.0.2273547
- Microsoft AL CLI: 18.0.39.10160
- Visual Studio Code: 1.132.0 (ARM64)
- Business Central: 28.3.52162.53349
- Permissions Mock: 28.3.52162.53349
- Test app target: application/platform 28.0.0.0, runtime 17.0
- Symbols used for the local compile check: 28.3.52162.53349
- List of Visual Studio Code extensions that you have installed:
ms-dynamics-smb.al@17.0.2273547
ms-vscode.extension-test-runner@0.0.14
- Operating System: Windows Enterprise 25H2, build 26200.8893
Final Checklist
Please remember to do the following:
1. Describe the bug
The result of a test that calls
ClearAssignments()on Microsoft'sPermissions Mockcodeunit depends on how the test is started. The testpasses when it is run from the AL Test Tool page in the Business Central
web client. When the same test is run with the Extension Test Runner in
Visual Studio Code, it fails because the internal DotNet variable for
Microsoft.Dynamics.Nav.Runtime.PermissionTestHelperhas not beeninstantiated. The same failure can alternatively be reproduced with the
Microsoft AL CLI (
al runtests).The exception is raised inside Microsoft codeunit 131006 before any
application-specific business logic is executed. The problem was observed
after the Business Central environment and the Microsoft test libraries had
been updated to version 28.3.52162.53349. The test app targets Business Central
28.x and runtime 17.0.
The reproduction project has no dependency on a customer or partner
application. Its only direct dependency is Microsoft's
Permissions Mockapplication.
2. To Reproduce
Steps to reproduce the behavior:
libraries installed.
Code.
Permissions Mock Reprotest app.codeunit
50100 PMR Permissions Mock Repro, and run test methodClearAssignmentsWithoutPriorSetup. The test succeeds.with the Extension Test Runner. The test fails in
Permissions Mock.ClearAssignments().Alternatively, run the same method with Microsoft AL CLI 18.0.39.10160:
The CLI test run fails with the same error.
The relevant dependency and target versions in
app.jsonare:{ "dependencies": [ { "id": "40860557-a18d-42ad-aecb-22b7dd80dc80", "name": "Permissions Mock", "publisher": "Microsoft", "version": "28.0.0.0" } ], "platform": "28.0.0.0", "application": "28.0.0.0", "runtime": "17.0", "target": "Cloud" }3. Expected behavior
The test should produce the same result regardless of whether it is run from
the AL Test Tool page, the Extension Test Runner in Visual Studio Code, or the
Microsoft AL CLI.
PermissionsMock.ClearAssignments()should clear any existing permissionassignments and return successfully. Calling it before any assignments have
been made should be a valid no-op and should not require application code to
initialize an internal Microsoft DotNet variable.
4. Actual behavior
The test succeeds when it is run from the AL Test Tool page. When the same test
is run with the Extension Test Runner in Visual Studio Code, it fails
immediately in
Permissions Mock.ClearAssignments()with the following error.The alternative Microsoft AL CLI 18.0.39.10160 execution produces the same
failure:
Sanitized and translated excerpt from the confirmed AL CLI run:
The message states that no instance was created for the DotNet variable before
Microsoft.Dynamics.Nav.Runtime.PermissionTestHelper.Clearwas invoked. Thedifference between the execution paths suggests that the AL Test Tool page
initializes the permission test helper, while the Extension Test Runner and AL
CLI execution paths do not.
5. Versions:
ms-dynamics-smb.al@17.0.2273547ms-vscode.extension-test-runner@0.0.14Final Checklist
Please remember to do the following:
Search the issue repository to ensure you are reporting a new issue
No matching issue was found for
Permissions Mock,ClearAssignments, orPermissionTestHelper.Clearinmicrosoft/ALormicrosoft/ALAppExtensionson 2026-08-08.Reproduce the issue after disabling all extensions except the AL Language extension
The issue was reproduced again after uninstalling all third-party Visual
Studio Code extensions. Only
ms-dynamics-smb.al@17.0.2273547andMicrosoft's
ms-vscode.extension-test-runner@0.0.14remained installed. Thecheckbox is left open because the second Microsoft extension was still
present. The failure was also reproduced with the standalone Microsoft AL
CLI, where no Visual Studio Code extension participates in test execution.
Simplify your code around the issue to better isolate the problem
The reproduction contains one test codeunit and one method call, with no
dependency on partner application code.