Well I had a bit more of a look and have understood that amazingly (to me anyway) this does not cause a compile error. It causes a run time error.

The compiler will accept this:

Code:
//ThrowIfFailed(mSwapChain->GetBuffer(i, IID_PPV_ARGS(&mSwapChainBuffer[i])));		
		md3dDevice->CreateRenderTargetView(mSwapChainBuffer[i].Get(), nullptr, rtvHeapHandle);
		rtvHeapHandle.Offset(1, mRtvDescriptorSize);
With the mSwapChain->GetBuffer part commented out. The function however:

Code:
ThrowIfFailed(md3dDevice->CreateCommittedResource(
        &CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT),
		D3D12_HEAP_FLAG_NONE,
        &depthStencilDesc,
		D3D12_RESOURCE_STATE_COMMON,
        &optClear,
        IID_PPV_ARGS(mDepthStencilBuffer.GetAddressOf())));
fails at run time with a message that there is an issue with the GPU instance. For those who don't know the md3dDevice is a COMPtr of type <ID3D12Device>. Now there's a lot of code between the first function (where I commented out a line) and the second one which causes a run-time failure. All of this runs fine.

So.... the culprit it seems is indeed...md3dDevice. When i saw the error message stating that the GPU instance (md3dDevice) had been suspended it became a little clearer. By commenting out the mSwapChain->GetBuffer call it appears something has indeed happened with (most likely) a COM reference. That has then screwed up something in the md3dDevice which means when it's called a second time (it compiles ok) it fails at run-time.

This is actually starting to look like a COMPtr issue. I'll quote the book I'm reading as follows with regards to the mSwapChain->GetBuffer call:

The call to IDXGISwapChain::GetBuffer increases the COM reference count to the back buffer, so we must Release it when we are finished with it.

To those who don't know the IDXGISwapChain contains two buffers which are used in graphics rendering. One is the front buffer one is the back buffer. Their pointers are swapped each time a frame is rendered so nothing is ever seen being drawn on screen. It's all drawn to the back buffer which is then presented to the monitor (display output).

But that's by the by. What isn't by the by is that if this function is called:

Code:
md3dDevice->CreateRenderTargetView(mSwapChainBuffer[i].Get(), nullptr, rtvHeapHandle);
And this preceding line is not executed:

Code:
ThrowIfFailed(mSwapChain->GetBuffer(i, IID_PPV_ARGS(&mSwapChainBuffer[i])));
the code compiles but buggers up the md3dDevice instance when then causes the following function:

Code:
ThrowIfFailed(md3dDevice->CreateCommittedResource(
        &CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT),
		D3D12_HEAP_FLAG_NONE,
        &depthStencilDesc,
		D3D12_RESOURCE_STATE_COMMON,
        &optClear,
        IID_PPV_ARGS(mDepthStencilBuffer.GetAddressOf())));
to fail at run time.

At this moment I've no idea why but I will keep trying to find out what this is and I'll post updates when/if I make any progress. I don't really expect any more replies from anyone I just think I should try and follow up myself on a question I've asked.

Well.. thanks John for replying and to anyone else who reads this cheers