Slow debugging with object reference

I am using NSight Tegra version 1.5.1 with Visual Studio 2013.

I have a very strange problem that is slowing down the debugger to the point that it becomes unusable. I have a simple accessor function that returns a reference to an object. If I set a breakpoint in the code that calls this accessor, Visual Studio hangs for about 20 seconds and becomes unusable after that. If I change the accessor to use a pointer instead of a reference, everything runs fine.

The accessor looks like this:

RenderContext& GraphicsPackage::GetDefaultContext()
{
	return *m_DefaultContext;
}

m_DefaultContext is just a pointer member variable.

The calling code looks like this:

RenderContext& context = m_GraphicsPackage->GetDefaultContext();

Changing the code to just return a pointer fixes the problem, but this is part of a large codebase and I don’t want to start changing interfaces just to satisfy the debugger. This is the pointer version of that same function:

RenderContext* GraphicsPackage::GetDefaultContext()
{
	return m_DefaultContext;
}

Any ideas of what could be causing this problem?

Hi, can you reproduce this behavior again and send me the log file from
c:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\NVIDIA\Nsight Tegra\1.5.1 folder?

I can give you my email address or access to our corporate FTP with upload rights - just send me a PM here at the forums.