public void TestCtor2() { var args = new[] { Process.GetCurrentProcess().Id.ToString(CultureInfo.InvariantCulture), "false", //< collect minidumps "true", //< suppress error windows "false", //< handle access violations "false", //< handle crt asserts "false", //< handle pure virtual function calls ((int)(CRuntimeVersions._71 | CRuntimeVersions.Debug)).ToString(CultureInfo.InvariantCulture), "100", //< num minidumps retained, @"C:\foo dumps\", "Test" }; using (var server = new OutOfProcessSiloServer(args)) { var actualSettings = server.PostMortemSettings; actualSettings.CollectMinidumps.Should().BeFalse(); actualSettings.SuppressErrorWindows.Should().BeTrue(); actualSettings.HandleAccessViolations.Should().BeFalse(); actualSettings.HandleCrtAsserts.Should().BeFalse(); actualSettings.HandleCrtPureVirtualFunctionCalls.Should().BeFalse(); actualSettings.RuntimeVersions.Should().Be(CRuntimeVersions._71 | CRuntimeVersions.Debug); actualSettings.NumMinidumpsRetained.Should().Be(100); actualSettings.MinidumpFolder.Should().Be(@"C:\foo dumps\"); actualSettings.MinidumpName.Should().Be("Test"); } }
private static void Main() { try { throw new FileNotFoundException("Shit happens", "Important File.dat"); } catch (Exception e) { OutOfProcessSiloServer.ReportException(e); } }
public void TestCtor2() { var args = new[] { Process.GetCurrentProcess().Id.ToString(CultureInfo.InvariantCulture), }; using (var server = new OutOfProcessSiloServer(args, endPointName: "Foobar")) { server.Name.Should().Be("Foobar", "because we specified this name in the ctor"); } }
public void TestCtor1() { var args = new[] { Process.GetCurrentProcess().Id.ToString(CultureInfo.InvariantCulture), }; var heartbeatSettings = new HeartbeatSettings { Interval = TimeSpan.FromSeconds(1.5), ReportSkippedHeartbeatsAsFailureWithDebuggerAttached = true, SkippedHeartbeatThreshold = 11 }; var latencySettings = new LatencySettings { Interval = TimeSpan.FromSeconds(1.5), NumSamples = 8, PerformLatencyMeasurements = true }; using (var server = new OutOfProcessSiloServer(args, heartbeatSettings: heartbeatSettings, latencySettings: latencySettings)) { var endPoint = server.EndPoint; endPoint.Should().NotBeNull(); endPoint.LatencySettings.Should().BeSameAs(latencySettings); endPoint.LatencySettings.Interval.Should().Be(TimeSpan.FromSeconds(1.5)); endPoint.LatencySettings.NumSamples.Should().Be(8); endPoint.LatencySettings.PerformLatencyMeasurements.Should().BeTrue(); endPoint.HeartbeatSettings.Should().BeSameAs(heartbeatSettings); endPoint.HeartbeatSettings.Interval.Should().Be(TimeSpan.FromSeconds(1.5)); endPoint.HeartbeatSettings.ReportSkippedHeartbeatsAsFailureWithDebuggerAttached.Should().BeTrue(); endPoint.HeartbeatSettings.SkippedHeartbeatThreshold.Should().Be(11); Task.Factory.StartNew(() => server.Run(IPAddress.Loopback, 60000, 60010)); WaitFor(() => endPoint.LocalEndPoint != null && Enumerable.Range(60000, 10).Contains(endPoint.LocalEndPoint.Port), TimeSpan.FromSeconds(10)) .Should() .BeTrue(); } }
public void TestEncodeException() { var exception = new ArgumentNullException("whatever"); string encoded = null; new Action(() => encoded = OutOfProcessSiloServer.EncodeException(exception)) .Should().NotThrow(); encoded.Should().NotBeNull(); encoded.Length.Should().BeGreaterThan(0); using (var stream = new MemoryStream(Convert.FromBase64String(encoded))) using (var reader = new BinaryReader(stream)) { var actualException = AbstractEndPoint.ReadException(reader); actualException.Should().NotBeNull(); actualException.Should().BeOfType <ArgumentNullException>(); actualException.Message.Should().Be(exception.Message); } }
private static void Main(string[] args) { try { GlobalContext.Properties["pid"] = Process.GetCurrentProcess().Id; XmlConfigurator.Configure(new FileInfo("SharpRemote.Host.exe.config")); AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException; using (var silo = new OutOfProcessSiloServer(args)) { silo.Run(IPAddress.Loopback); } } catch (Exception e) { Log.ErrorFormat("Caught unexpected exception, terminating...: {0}", e); OutOfProcessSiloServer.ReportException(e); } }
public void TestCtor7() { var args = new[] { Process.GetCurrentProcess().Id.ToString(CultureInfo.InvariantCulture), }; var heartbeatSettings = new HeartbeatSettings { Interval = TimeSpan.FromSeconds(1.5), ReportSkippedHeartbeatsAsFailureWithDebuggerAttached = true, SkippedHeartbeatThreshold = 11 }; var latencySettings = new LatencySettings { Interval = TimeSpan.FromSeconds(1.5), NumSamples = 8, PerformLatencyMeasurements = true }; using (var server = new OutOfProcessSiloServer(args, heartbeatSettings: heartbeatSettings, latencySettings: latencySettings)) { var endPoint = server.EndPoint; endPoint.Should().NotBeNull(); endPoint.LatencySettings.Should().BeSameAs(latencySettings); endPoint.LatencySettings.Interval.Should().Be(TimeSpan.FromSeconds(1.5)); endPoint.LatencySettings.NumSamples.Should().Be(8); endPoint.LatencySettings.PerformLatencyMeasurements.Should().BeTrue(); endPoint.HeartbeatSettings.Should().BeSameAs(heartbeatSettings); endPoint.HeartbeatSettings.Interval.Should().Be(TimeSpan.FromSeconds(1.5)); endPoint.HeartbeatSettings.ReportSkippedHeartbeatsAsFailureWithDebuggerAttached.Should().BeTrue(); endPoint.HeartbeatSettings.SkippedHeartbeatThreshold.Should().Be(11); } }