Closed apaGitHub closed 3 years ago
Thanks for the reply.
1. I assume that you have a sandbox named XYZ -SANDBOX? 2. I assume that you have started debugging with F5? 3. If you trigger a message box from the event that is visible when you run the application? Testing that your event subscription is really called. 4. Search also in the bin subdirectories too for the debuggerservices.log file. It should be there, else you are not debugging with the Debug Adapter for the AL language extension.
Your assumptions are correct:
Yes, the subscription is really called, but to show via triggering a message box, I have refactored the codeunit (below) and then provided the screenshots of the messages. The changes occur as expected.
"al.editorServicesLogLevel": "Debug"
But then changed it to:
"al.editorServicesLogLevel": "Verbose"
Changing it back to "al.editorServicesLogLevel": "Debug"
has not had an effect and the folder is empty, no bin subdirectories.
This folder seems to be associated with the "AL XML Documentation," I have a newer version with subfolders created at a previous time yesterday (see image below settings.json) but the but the bin folder seems to have only files associated with ALCodeCommentMarkdownCreator.Does it then seem that I am "not debugging with the Debug Adapter for the AL language extension"?
How to determine if I am not debugging with the Debug Adapter for the AL language extension? Attached also is my settings.json file (below).
[EventSubscriber(ObjectType::Table, Database::Customer, 'OnAfterValidateEvent', 'Payment Method Code', true, true)]
local procedure XYZ_Customer_MethodPaymentCode_OnAfterValidate(var Rec: Record Customer)
var
SalesHeader: Record "Sales Header";
begin
SalesHeader.SetRange("Sell-to Customer No.", Rec."No.");
Message('Change made to the Customer Card Payment Method Code');
Count := 0;
if SalesHeader.FIND('-') then
repeat
Count := Count + 1;
until SalesHeader.NEXT = 0;
MESSAGE(Text000 + '%1', Count);
Count := 0;
if SalesHeader.FindSet(true, false) then
repeat
Count := Count + 1;
MESSAGE(Text001 + Text002 + '%1', Count);
SalesHeader.Validate("Payment Method Code", Rec."Payment Method Code");
SalesHeader.Modify(true);
until SalesHeader.Next() = 0;
end;
var
Count: Integer;
Text000: Label 'SalesHeader.FIND Count: ';
Text001: Label 'Change to Sales Order or Credit Memo Payment Method Code\';
Text002: Label 'The Count: ';
}
after launch:
settings.json
{
"workbench.iconTheme": "vscode-icons",
"telemetry.enableTelemetry": false,
"telemetry.enableCrashReporter": false,
"editor.renderControlCharacters": false,
"files.autoSave": "afterDelay",
"editor.wordWrap": "on",
"workbench.colorTheme": "Default Light+",
"editor.selectionHighlight": false,
"editor.occurrencesHighlight": false,
"window.zoomLevel": 0,
"spellright.documentTypes": [
"markdown",
"latex",
"plaintext"
],
"spellright.ignoreFiles": [
"**/.gitignore",
"**/.spellignore"
],
"spellright.language": [
],
"spellright.languageContext": {
},
"cSpell.userWords": [
"Mgmt",
"Packt",
"Walkthrough"
],
"workbench.sideBar.location": "left",
"todo-tree.tree.showScanModeButton": false,
"dashboard.projectData": null,
"zenMode.centerLayout": false,
"zenMode.fullScreen": false,
"bdev-al-xml-doc.checkProcedureDocumentation": true,
"al.enableCodeActions": true,
"al.codeAnalyzers": [
"${AppSourceCop}","${CodeCop}"
],
"editor.fontSize": 12,
"editor.lineHeight": 14,
"debug.allowBreakpointsEverywhere": true,
"al.editorServicesLogLevel": "Verbose"
}
.vscode\extensions directories that were updated yesterday (when working with the "al.editorServicesLogLevel": setting:
No subdirectories, not sure what,if anything, it has to do with debugging?
Has subdirectories, later version, earlier time modified.
This issue was resolved on the Dynamics 365 Business Central/NAV User Group Developers Forum (Help needed: The Vs Code debugger (AL code) does not work; does not stop on breakpoints).
Apparently the issue revolved around web sessions. After clearing .alchache in VS Code and the browser cache, I also cleared the VS Code credentials cache and then canceled the session in Dynamics 365 Business Central admin center. I then signed in with new credentials, the app launched, and the debugger worked as expected.
No other changes were made. Since then, non of the above steps taken seem necessary, and the debugger works after F5 and then calling the subscription as previously noted.
Hi I got the same problem. All of a sudden debugging stopped to work. I also tried clear credentials and reload windows in VS code. That did not work. I tried to delete files in .alcache and .alpackages folder. That did not work. I also tried adding to settings.json: "debug.allowBreakpointsEverywhere": true, That did not work. Then I deleted browsing data in Edge web browser. clear credentials and reload windows in VS code. This seemed to work! /J
Describe the bug The app is published and works as expected (Payment Method Code for 8 Sales Orders for Adatum Corporation – and any other I try - are changed when the Customer Card Payment Method Code is changed), with below launch.json, app.json, and codeunit used to test the debugger.
The debugger does not stop at breakpoints, or otherwise seem to work.
The only result I have seen in the debugger is that the CALL STACK will sometimes show “RUNNING.”
To Reproduce Steps and to reproduce the behavior: Aside from the below files, have also tried to use in settings.json:
"al.editorServicesLogLevel": "Debug". (restarted VS Code to take effect)
And then"al.editorServicesLogLevel": "Verbose" (restarted VS Code to take effect)
EditorServices.log, and the debugger (DebuggerServices.log) are NOT output to the C:\Users\.vscode\extensions... \bin directory.
The only new directory created in the path is 365businessdevelopment.bdev-al-xml-doc-1.0.2, which is empty. There is this “Unknown Config Setting” added setting to settings.json:
bdev-al-xml-doc.checkProcedureDocumentation": true, (tried true and false without causing an effect).
Cleared browser cache. Cleared .alchache in VS Code.
In total, no effect to get the debugger to pause on breakpoints.
AL Code to reproduce the issue
launch.jsonin launch.json had also tried:
"breakOnRecordWrite": true (no effect)
app.json
codeunit
In the above codeunit, also went to Go to definition for “Sales Header” Opened: table 36 "Sales Header", set breakpoint on InitInsert, with no effect.
Expected behavior VS Code should stop on breakpoints and show elements in debugger side panel.
Screenshots If applicable, add screenshots to help explain your problem.
5. Versions:
VS Code: Version: 1.51.1 AL Language: v6.1.362735
In BC Sandbox, using CRONUS USA, Inc.: Application Version: 17.0.16993.0 Platform Version: 17.0