chakradiag.dll Error in Windows 10 and 11: Legacy Windows script debugging

A legacy script host runs its application but crashes when a developer attaches its diagnostic tools, and the report identifies chakradiag.dll.
The Windows file inventory identifies chakradiag.dll as Microsoft ® Chakra Diagnostics (Private). Capture the actual error, file path and Windows build before making changes.
Check where the error occurs
Confirm that the application can perform the same action without the debugger. Record the debugger version, target app and DLL path, especially on a Windows build changed since it was installed.
Repair the affected feature
Use the host's supported diagnostic tooling and update the approved development components together. Apply Windows servicing for a confirmed system copy issue.
If Windows reports corruption of a protected system file, use Microsoft’s system file repair procedure. Obtain software and drivers through Windows Update or the applicable publisher.
Verify the repair
Attach the supported debugger again, reproduce the script operation and check that breakpoints or the expected trace work while the app stays open.
See the publisher’s guidance, the exact Windows file record, and the related PC Repair Atlas guide.