提交 79b6d26e 编写于 作者: T Tom Meschter 提交者: GitHub

Merge pull request #17428 from tmeschter/AlwaysTakeScreenshot

Always take screenshots when an exception occurs
......@@ -52,17 +52,14 @@ private static void FirstChanceExceptionHandler(object sender, FirstChanceExcept
{
try
{
if (eventArgs.Exception is XunitException)
{
var assemblyPath = typeof(VisualStudioInstanceFactory).Assembly.Location;
var assemblyDirectory = Path.GetDirectoryName(assemblyPath);
var testName = CaptureTestNameAttribute.CurrentName ?? "Unknown";
var fileName = $"{testName}-{eventArgs.Exception.GetType().Name}-{DateTime.Now:HH.mm.ss}.png";
var assemblyPath = typeof(VisualStudioInstanceFactory).Assembly.Location;
var assemblyDirectory = Path.GetDirectoryName(assemblyPath);
var testName = CaptureTestNameAttribute.CurrentName ?? "Unknown";
var fileName = $"{testName}-{eventArgs.Exception.GetType().Name}-{DateTime.Now:HH.mm.ss}.png";
var fullPath = Path.Combine(assemblyDirectory, "xUnitResults", "Screenshots", fileName);
var fullPath = Path.Combine(assemblyDirectory, "xUnitResults", "Screenshots", fileName);
ScreenshotService.TakeScreenshot(fullPath);
}
ScreenshotService.TakeScreenshot(fullPath);
}
catch (Exception e)
{
......@@ -166,7 +163,7 @@ private static ISetupConfiguration GetSetupConfiguration()
{
// Fallback to P/Invoke if the COM registration is missing
var hresult = NativeMethods.GetSetupConfiguration(out var setupConfiguration, pReserved: IntPtr.Zero);
if (hresult < 0)
{
throw Marshal.GetExceptionForHR(hresult);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册