The part that is missing here is the shared Texture2D creation. This PR removes the code:

            if (shared)
                desc.OptionFlags |= SharpDX.Direct3D11.ResourceOptionFlags.Shared;

By moving all of the texture init code to CreateTexture, but CreateTexture does not know how to create a shared texture.