xtensor uses allocator to allocate xarray, but unlike new T[N] which does not return nullptr if N == 0, std::allocator<char>{}.allocate(m_n_bytes) may return nullptr. When it happens in MSVC STL runtime, the following code
if (m_buffer == nullptr)
{
XTENSOR_THROW(std::runtime_error, "This npy_file has already been cast.");
}
will deem a zero-sized array from npy file not exists.