Error when saving cpp file

Sysprogs forums Forums VisualGDB Error when saving cpp file

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #27890
    vshashi01
    Participant

    I am using Visual Studio 2019 with the VisualGDB extension. Lately whenever I make any changes and try to save a .cpp file an error is shown to me. I dont understand why its being shown to me. The.h files does not have the same issue.

    The error shown is as shown in the attachment. What could be causing this issue? Its getting too annoying.

     

    Attachments:
    You must be logged in to view attached files.
    #27892
    support
    Keymaster

    No problem, we can help you narrow it down. Please try checking if the problem only happens for a specific project, or also for a newly created project of the same type.

    If it doesn’t happen to all projects, please try understanding the difference between the working and broken projects.

    You can also try getting a call stack of the problem by attaching a debugger to Visual Studio as shown here: https://visualgdb.com/support/callstack. Then try reproducing the problem and check the Output window in the outer VS instance for the “exception of type XYZ was thrown” messages. Once you get the exception name, please try configuring the outer VS to break on that exception via Debug->Exceptions. This will catch the exact moment when the problem happens. If you could share the call stack from that event, along with your VisualGDB build number, we should be able to see what is going on.

    #27894
    vshashi01
    Participant

    Hi,

    Actually the problem is happening for specific files in the same project even. I have one project with multiple .cpp and .h files. Non of the header files seems to have the problem, only specific .cpp files seems to have the problem.

    The Stack Trace

    [Managed to Native Transition]
    > Elders.VSE_FormatDocumentOnSave.dll!Elders.VSE_FormatDocumentOnSave.VisualStudioCommandFormatter.Format(EnvDTE.Document document, Elders.VSE_FormatDocumentOnSave.IDocumentFilter filter, string command) Unknown
    Elders.VSE_FormatDocumentOnSave.dll!Elders.VSE_FormatDocumentOnSave.DocumentFormatService.FormatDocument(EnvDTE.Document doc) Unknown
    Elders.VSE_FormatDocumentOnSave.dll!Elders.VSE_FormatDocumentOnSave.FormatDocumentOnBeforeSave.OnBeforeSave(uint docCookie) Unknown

     

    Looks like the problem is on the Formatter.

    VisualGDB version 5.3 (Preview 3, Build 3458)

    I will continue investigating whats the difference between the different .cpp files.

    Thank you.

     

    #27897
    support
    Keymaster

    Yes, this looks like an issue in the VSE_FormatDocumentOnSave.dll extension and not in VisualGDB. Please consider disabling that extension, or contacting its authors for troubleshooting advice.

    #27900
    vshashi01
    Participant

    Hi again,

    I disabled the plugin and tried to format my code manually by calling the Format Document tool and still see the same error. So no I dont think the problem is in the plugin. When I try to debug the problem now, it just shows that no external code is running only native platform code is running.

    Is there any other way I can still find out whats going wrong?

    Thank you.

    #27903
    support
    Keymaster

    Strange, the “value doesn’t fall in the expected range” looks like a .Net exception message, so you should normally still get a .Net assembly that triggers the exception. Can you confirm that the error message still looks the same after disabling the plugin? Does the outer VS instance show any exceptions in the “Output” window?

    Please also try disabling the Clang IntelliSense as shown here and check if it solves the problem. If yes, please try enabling it back and then reformat the entire document (Edit->Advanced->Format Document). Does this trigger the problem?

    #27908
    vshashi01
    Participant

    Yes the error message is exactly same as the one before. Indeed there is not unusual exception in the Output window and the Call Stack is completely empty when I select the Main thread as shown below.

    I tried toggling both the Intellisense and the Code Formatting setting one by one. Indeed changing the Intellisense fixes the problem as well and so do changing the Code Formatting to use the Legacy Formatting. So indeed Clang Formatting is the one causing this issue. Could it be possibly caused by changed to the Clang formatting document? I have added my clang-format document for good measure.

    Attachments:
    You must be logged in to view attached files.
    #27910
    vshashi01
    Participant

    Re up0loading clang-format file as a txt file.

    Attachments:
    You must be logged in to view attached files.
    #27916
    support
    Keymaster

    No problem, we should be able to fix it. However, if the issue only triggers with a few select files, we would need further information from you.

    Please try creating a new embedded project from scratch. Then the .clang-format file in its directory and replace the contents of the main file with the minimal file contents that trigger the error when either saving or reformatting the document (via Edit->Format Document). Then please attach the entire repro project and we should be able to fix this promptly. You can alternatively send the repro project via our support form.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.