Color management with the DirectX 11 shader

If you enable Color Management (under the Color Management section of the Preferences window) and enable Linear Space Lighting in the dx11Shader using the Attribute Editor, gamma is only applied once and your shading renders correctly.

You can use the semantic MayaGammaCorrection to query if gamma is enabled in the viewport.