public static int GetPort() { int?result = null; while (result == null) { result = PortGenerator.GetPortLock(); if (result == null) { Thread.Sleep(WaitMilliseconds); } } return(result ?? throw new ArgumentOutOfRangeException("genereted port cannot be null")); }
public AppInstance() { Port = PortGenerator.GetPort(); App = ConfigureApp().Build(); App.RunAsync(); }