Map() fails when reading back GPU Texture

I need to read back a GPU texture (stored in the GPU as D3D11_USAGE_DEFAULT). I am doing this via creating a staging ID3D11Texture. The whole application is running in a Microsoft Store application.

I am starting from a D3D11ShaderResourceView defined in the cResourceShaderView variable below. Code follows:

    ID3D11Texture2D* pTextureInterface = 0;     ID3D11Resource* res;     HRESULT hr = 0;      ID3D11Texture2D* tx = 0;          ID3D11Device* dv;     deviceContext->GetDevice(&dv);      cResourceShaderView->GetResource(&res);     hr = res->QueryInterface<ID3D11Texture2D>(&pTextureInterface);     D3D11_TEXTURE2D_DESC desc;     pTextureInterface->GetDesc(&desc);      desc.Usage = D3D11_USAGE_STAGING;     desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;     desc.BindFlags = 0;      hr = dv->CreateTexture2D(&desc, nullptr, &tx);     deviceContext->CopyResource(tx, pTextureInterface);       D3D11_MAPPED_SUBRESOURCE mapped = { 0 };     hr = deviceContext->Map(tx, 0, D3D11_MAP_READ, 0, &mapped); 

The Map() function fails with an E_INVALIDARG.

I have turned on Debug Layers and there are no specific Warnings nor Errors in the VS Window for all these code above.

If I try to save this texture using the DirectX::SaveWICTextureToFile function which uses this same method in the sample, inside this function the Map() function call here fails as well with an E_INVALIDARG and without any Debug Warnings nor Errors.

The GetDesc() function gives me a valid D3D11_TEXTURE2D_DESC for that texture.

enter image description here

What could be wrong?