Use InvalidOperationException
Merge pull request #419 from XLabs/fix-nre-resolver

Use InvalidOperationException fixes #413