Originally reported at aspnet/Hosting#287 (comment)
The issue is that TestHost uses ApplicationHost to bootstrap xunit. This causes the ApplicationHost initialization code to run again, but since ApplicationHost has already processed the --port argument it's already configured the DTH compiler. When run again without the --port argument, the IRuntimeOptions object that's created doesn't have a port set, resulting in the failure described in the original issue.
A quick fix to this issue is to pass the --port manually when recursing into ApplicationHost. It's been on roadmap to remove the ApplicationHost dependency for some time now, so we should bump up the priority of that as well.