Error in UE4.natvis

The VS natvis file included with the engine has at some point ceased to properly display TMap and TSet variables. I’m not certain but I believe this may be down to a change from VS 2013 to 2015. Regardless, the fix just requires adding some missing double quotes on a couple of lines. A fixed version is available here, though that was based on the 4.10 version so will likely need integrating with any other changes made since then.

Submitting this here since the file is not part of the Github repo so a PR is not possible.

Hey -

Can you identify exactly where you added your changes to the .natvis file? Also, can you list/explain the steps you use to setup/use a TMap and TSet so that I can investigating what you’re seeing. Please be sure to include any information that will help me reproduce on my end.

Cheers

Lines 228 & 229, 301 & 302, 316 & 317. If you diff the linked file against the 4.10 version, you will see the changes. Double quotes just need adding around the word ‘Invalid’ in each case.

I don’t know what you mean by steps to setup. If you just break the VS (2015 version) debugger anywhere in code that has a TMap or TSet variable that isn’t empty and attempt to inspect it in the watch window, you won’t get the nice formatted list of contents that you should. This is because it failed to parse the natvis file so just reverted to default visualization.

Are you doing this in the code of a project or in downloaded engine source code? Can you point out any specific examples of TMaps/TSets that you are watching? What difference do you notice between when it was displaying properly vs. when it is not displaying properly. I have not used natvis previously and want to make sure that I’m seeing the same results you’re reporting.

Here’s how it should look when you inspect a TMap variable in VS:

78717-natvis_working.jpg

And this is how it shows without the changes:

It makes no difference what map variable you are looking at, engine or project. Simple repro would be to just create a C++ actor class, override BeginPlay, and do something like:

TMap< int32, int32 > Test;
Test.Add(1, 10);
Test.Add(2, 20);

Super::BeginPlay();

Add a breakpoint on the Super line, add the actor to a level, hit play and then inspect the Test variable when it breaks.

Thank you for all the information you’ve provided. I was able to see the results you mentioned and have entered a report (UE-27000) for the TMap/TSet display when inspecting.

Cheers

This has been fixed and should make it into the 4.11 build. TSparseArray also had the same problem.

Steve

I don’t know if it’s related but since I use TMap with pointers VS crash on debug.

Hey -

This issue has been fixed and should be included as a part of the 4.12 release. If you are still getting a crash after the release please open a new post with information about your crash (such as log files and crash callstack).