Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VisualD having many bugs since upgrading #263

Open
Aphexus opened this issue Nov 6, 2023 · 8 comments
Open

VisualD having many bugs since upgrading #263

Aphexus opened this issue Nov 6, 2023 · 8 comments

Comments

@Aphexus
Copy link

Aphexus commented Nov 6, 2023

Recently I upgraded Visual Studio 2022 to latest(I didn't upgrade for several months) and upgraded VisualD too (everything to latest).

Ever since I've been having major issues.

  1. I cannot debug programs. Either VS crashes or I get an error about "evaluating expression 0" which stalls everything and VS just consumes an infinite amount of memory. Happens in x64 and x86 even with the most basic project. I'm not sure if it's trying to evaluate a watch or local variable and is stalling out or what.

Literally this is the program causing the problem:

import std.stdio;

int main()
{
return 0;
}

with a BP on the return. The crash only happens when the BP exists.

  1. VS sometimes just crashes when opening a project. This seems to be related to intellisense as it also crashes when I try to use intellisense. Intellisense is broken completely as it never returns anything. Well, maybe sometimes it works but I don't use it any more because of the crashing.

  2. I get this error:
    Error errors in imported modules: Error: C:\D\dmd\src\phobos\std\range\package.d(1028): => shortened method not enabled, compile with compiler switch -preview=shortenedMethods...

I've added those to the command line in options but it does nothing. I do not get that error in x86 just x64. I lied, it is now happening in x86. [I changed to mago debugger and it started happening but not sure if it's actually connected]

VisualD has become unusable because of these. I had no problems with it before. All I can do is write code and execute it outside VS and use console printing to try and debug.

VisualStudio.17.Release/17.7.5+34202.233
Microsoft .NET Framework Version 4.8.09032

Visual D 1.3.1
Integration of the D Programming Language into Visual Studio

I just updated to Visual D 1.4 beta and same issue as 1. With the update and setting to x64:

cannot launch debugger on
C:\Temp\test.exe
hr = 89710016

This is mago related(because I had it set to it before) so changing to mixed mode works. Of course setting BP causes error.

This was a new project so all the settings should be the default project settings.

I'm not really sure what is going on or how to provide any more useful information. Again, everything was working fine until I updated VS.

I also constantly get this "Microsoft Visual C++ runtime library" error dialog that says:

Program C:\Program Files (x86)\visualD\dmdserver.exe

HEAP CORRUPTION DETECTED: after Normal Block (#xxxxx) at xxxxxx.
CRT detected that the application wrote to memory after end of heap buffer.

It constantly pops up once it gets going(may be related to intellisense)

@rainers
Copy link
Member

rainers commented Nov 29, 2023

Sorry to hear that Visual D no longer works for you. VS 2022 is the first 64-bit version of Visual Studio, maybe something didn't migrate too well. Some notes:

I cannot debug programs.

I cannot reproduce. Can you provide crash dumps?

Error errors in imported modules: Error: C:\D\dmd\src\phobos\std\range\package.d(1028): => shortened method not enabled

See #240 (comment). Should be supported in next release.

cannot launch debugger on C:\Temp\test.exe hr = 89710016

The mago debug engine is a 32-bit service that doesn't run in VS 2022 anymore. Please switch to native or mixed debugger. The mago expression evaluator is still available in these engines as an extension.

If the language server dmdserver.exe crashes, you should find crash dumps in %LOCALAPPDATA%\CrashDumps. These might help in figuring out issues.

@Aphexus
Copy link
Author

Aphexus commented Dec 31, 2023

FILE_IN_CAB: devenv.exe.217476.dmp

NTGLOBALFLAG: 0

PROCESS_BAM_CURRENT_THROTTLED: 0

PROCESS_BAM_PREVIOUS_THROTTLED: 0

APPLICATION_VERIFIER_FLAGS: 0

CONTEXT: (.ecxr)
rax=0000000000000000 rbx=0000000000000000 rcx=00007ff9fba70360
rdx=00000000ffffffbe rsi=0000000000000000 rdi=000001de263313c8
rip=00007ff9fb923aca rsp=0000007df9c7fc80 rbp=0000007df9c7fd29
r8=0000000000000000 r9=0000000000000000 r10=0000000000000000
r11=000000007ffe0300 r12=000001de263313d0 r13=0000000000000000
r14=0000000000000000 r15=00000000ffffffbe
iopl=0 nv up ei pl nz ac pe cy
cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010213
ntdll!RtlpWaitOnCriticalSection+0xaa:
00007ff9fb923aca ff4024 inc dword ptr [rax+24h] ds:0000000000000024=????????
Resetting default scope

EXCEPTION_RECORD: (.exr -1)
ExceptionAddress: 00007ff9fb923aca (ntdll!RtlpWaitOnCriticalSection+0x00000000000000aa)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 0000000000000001
Parameter[1]: 0000000000000024
Attempt to write to address 0000000000000024

PROCESS_NAME: devenv.exe

WRITE_ADDRESS: 0000000000000024

ERROR_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%p referenced memory at 0x%p. The memory could not be %s.

EXCEPTION_CODE_STR: c0000005

EXCEPTION_PARAMETER1: 0000000000000001

EXCEPTION_PARAMETER2: 0000000000000024

STACK_TEXT:
0000007df9c7fc80 00007ff9fb9118e4 : 0000000000000000 0000000000000000 0000000000000000 0000000000000000 : ntdll!RtlpWaitOnCriticalSection+0xaa
0000007df9c7fd90 00007ff9fb9116d2 : 0000000000000001 00007ff9fb943300 0000000000000000 0000000000000000 : ntdll!RtlpEnterCriticalSectionContended+0x204
0000007df9c7fe10 000001de261b29c1 : 0000000000000000 0000000000000000 0000031881c2cc65 0000000000000000 : ntdll!RtlEnterCriticalSection+0x42
0000007df9c7fe40 000001de261b2a19 : 0000000000000057 00007ff9fb943330 0000000000000000 0000007df9c7fea8 : VisualD!DllUnregisterServer+0x25a001
0000007df9c7fe70 000001de261a9509 : 0000000000000057 0000000000000003 0000031800000003 0000000000000000 : VisualD!DllUnregisterServer+0x25a059
0000007df9c7fea0 000001de261ab9aa : 0000000000000057 0000000000000000 0000000000000000 0000000000000000 : VisualD!DllUnregisterServer+0x250b49
0000007df9c7fed0 000001de261a7946 : 000001de033bdea0 0000000000000000 0000000000000000 0000000000000000 : VisualD!DllUnregisterServer+0x252fea
0000007df9c7ff00 00007ff9fa18257d : 0000000000000000 0000000000000000 0000000000000000 0000000000000000 : VisualD!DllUnregisterServer+0x24ef86
0000007df9c7ff30 00007ff9fb94aa58 : 0000000000000000 0000000000000000 0000000000000000 0000000000000000 : kernel32!BaseThreadInitThunk+0x1d
0000007df9c7ff60 0000000000000000 : 0000000000000000 0000000000000000 0000000000000000 0000000000000000 : ntdll!RtlUserThreadStart+0x28

SYMBOL_NAME: visuald+25a001

MODULE_NAME: VisualD

IMAGE_NAME: VisualD.dll

STACK_COMMAND: ~149s; .ecxr ; kb

FAILURE_BUCKET_ID: NULL_CLASS_PTR_WRITE_c0000005_VisualD.dll!Unknown

After upgrading to latest beta this crash happens regularly but not always. Also now VS just opens D project then quits most of the time. I still have the same issues and Visual D is nearly unusable except for compiling and editing(no debugging or executing).

@Aphexus
Copy link
Author

Aphexus commented Dec 31, 2023

Here is a snip of the crash dumb for a dmdserver.dmp

FILE_IN_CAB: dmdserver.exe.23784.dmp

NTGLOBALFLAG: 0

APPLICATION_VERIFIER_FLAGS: 0

CONTEXT: (.ecxr)
rax=696e696665642072 rbx=000001e1976f0000 rcx=0000000000000021
rdx=00007ffc607ecd80 rsi=000001e199768bc0 rdi=0000000000000021
rip=00007ffc606e9539 rsp=00000099d2bff2f0 rbp=000001e199768bc0
r8=000001e19bf1fb00 r9=000001e1976f0324 r10=0000000000000003
r11=00000099d2bff280 r12=000001e1976f007c r13=000001e199768bca
r14=000001e1976f0150 r15=000001e199768bd0
iopl=0 nv up ei pl zr na po nc
cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010246
ntdll!RtlpFreeHeap+0x429:
00007ffc606e9539 488b08 mov rcx,qword ptr [rax] ds:696e696665642072=????????????????
Resetting default scope

EXCEPTION_RECORD: (.exr -1)
ExceptionAddress: 00007ffc606e9539 (ntdll!RtlpFreeHeap+0x0000000000000429)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 0000000000000000
Parameter[1]: ffffffffffffffff
Attempt to read from address ffffffffffffffff

PROCESS_NAME: dmdserver.exe

READ_ADDRESS: ffffffffffffffff

ERROR_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%p referenced memory at 0x%p. The memory could not be %s.

EXCEPTION_CODE_STR: c0000005

EXCEPTION_PARAMETER1: 0000000000000000

EXCEPTION_PARAMETER2: ffffffffffffffff

ADDITIONAL_DEBUG_TEXT: Enable Pageheap/AutoVerifer ; Followup set based on attribute [Is_ChosenCrashFollowupThread] from Frame:[0] on thread:[PSEUDO_THREAD]

FAULTING_THREAD: 00005cb0

STACK_TEXT:
0000000000000000 0000000000000000 heap_corruption!dmdserver.exe+0x0

STACK_COMMAND: ** Pseudo Context ** ManagedPseudo ** Value: ffffffff ** ; kb

SYMBOL_NAME: heap_corruption!dmdserver.exe

MODULE_NAME: heap_corruption

IMAGE_NAME: heap_corruption

FAILURE_BUCKET_ID: HEAP_CORRUPTION_c0000005_heap_corruption!dmdserver.exe

OS_VERSION: 10.0.22621.1

dmdserver routinely crashes. I have no intellisense in visualD either(I think it crashes dmdserver and it pops up a abort retry cancel dialog in the background.

If I try to run an app in I get the error I stated before about accessing 0.

Maybe they are all related to the same bug but likely not.

@rainers
Copy link
Member

rainers commented Dec 31, 2023

Thanks for trying again. Can you upload the dmp files so I can load them into a debugger with debug symbols? You can also try it with the pdb files that you can find along side the release: https://github.com/dlang/visuald/releases/download/v1.4.0-beta2/visuald-symbols-1.4.0-beta2.zip

@Aphexus
Copy link
Author

Aphexus commented Jan 3, 2024

Rainers: I will work on debugging it. I wonder if you could perchance write a tutorial (video?) in setting up VisualD with Visual Studio and how you go about debugging using issues? I'm not that familiar with WinDbg(I used to use debug.com a long time ago but I haven't done much programming lately).

The tutorial wouldn't just be a one off so much be more effective in the long run. It wouldn't need to be in great detail. Maybe as you are fixing bugs you can record audio and video and then do a little setup tutorial(obviously you don't have to walk through basic stuff line how to install VisualD and such) and hit some key points. It might seem like a lot of work but it would probably pay off in the long run(more people contributing to patches).

For example, I've downloaded the symbols(I went ahead and just put them in the VisualD dir) but it didn't help with WinDbg as it doesn't seem to be loading them(I tried various things like adding directories, copying, symfix, etc).

@rainers
Copy link
Member

rainers commented Jan 5, 2024

Thanks for trying to debug visuald yourself. I very rarely use WinDbg for debugging, but just Visual Studio itself, though it's a bit more complicated to setup if visuald doesn't work at all.

There is some description of building and starting a debug environment at https://rainers.github.io/visuald/visuald/BuildFromSource.html, but unfortunately it has become a bit outdated. I will try to update that page soon.

I can have a look at crash dumps in the meantime if you just attach them here to this issue.

@rainers
Copy link
Member

rainers commented Feb 27, 2024

I recently noticed a crash in the debugger and fixed it. Please try https://github.com/dlang/visuald/releases/tag/v1.4.0-rc1

@Aphexus
Copy link
Author

Aphexus commented Mar 4, 2024

I installed. Still getting
vd

Ok, I saw in other thread about the 'load debug symbols in external process'. Disabling that setting and that error did not pop up so I was able to get to the set BP. I haven't tested it behind that but that seems to be the core issue. I think I set that setting a while back likely around the time when the problem started. I do not recall the specifics. It might have had something to do with Visual D/D or I was trying to debug some dumps for something else and was told to enable that.

I just noticed that if I have a BP in a collapsed code block the BP icon(red disk) does not show on the parent line. It makes it difficult to find BP's without hoops. E.g., there seems to be no check to see if the BP is being visually collapsed and then changing the line it is on visually. E.g., Having some indicator that BP is inside the collapsed block which might be better. E.g., a Red circle with a number inside containing the number of BP's inside the collapsed block.

Thanks for the work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants