Add .NET implementation of check_pid

Addresses #6243