This repository has been archived by the owner on Dec 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use regular PDBs on full desktop when possible
Add a test to verify exceptions thrown from views is pretty printed by diagnostics middleware Fixes aspnet/Diagnostics#293 Fixes #4737
- Loading branch information
Showing
5 changed files
with
90 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/Microsoft.AspNetCore.Mvc.Razor/Internal/SymbolsUtility.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Microsoft.AspNetCore.Mvc.Razor.Internal | ||
{ | ||
/// <summary> | ||
/// Utility type for determining if a platform supports full pdb file generation. | ||
/// </summary> | ||
public class SymbolsUtility | ||
{ | ||
private const string SymWriterGuid = "0AE2DEB0-F901-478b-BB9F-881EE8066788"; | ||
|
||
/// <summary> | ||
/// Determines if the current platform supports full pdb generation. | ||
/// </summary> | ||
/// <returns><c>true</c> if full pdb generation is supported; <c>false</c> otherwise.</returns> | ||
public static bool SupportsFullPdbGeneration() | ||
{ | ||
if (Type.GetType("Mono.Runtime") != null) | ||
{ | ||
return false; | ||
} | ||
|
||
try | ||
{ | ||
// Check for the pdb writer component that roslyn uses to generate pdbs | ||
var type = Marshal.GetTypeFromCLSID(new Guid(SymWriterGuid)); | ||
if (type != null) | ||
{ | ||
// This line will throw if pdb generation is not supported. | ||
Activator.CreateInstance(type); | ||
return true; | ||
} | ||
} | ||
catch | ||
{ | ||
} | ||
|
||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test/WebSites/ErrorPageMiddlewareWebSite/Views/ErrorPageMiddleware/RuntimeError.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@{ | ||
throw new Exception("Error from view"); | ||
} |