From f9661dfcd0de21bdc07b9926f8e1cc31b82a73f0 Mon Sep 17 00:00:00 2001 From: YishaiGalatzer Date: Wed, 22 Oct 2014 17:09:39 -0700 Subject: [PATCH] Fix pdb generation for win7/coreclr --- .../Compilation/RoslynCompilationService.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNet.Mvc.Razor/Compilation/RoslynCompilationService.cs b/src/Microsoft.AspNet.Mvc.Razor/Compilation/RoslynCompilationService.cs index 9d2a2962ee..2139048431 100644 --- a/src/Microsoft.AspNet.Mvc.Razor/Compilation/RoslynCompilationService.cs +++ b/src/Microsoft.AspNet.Mvc.Razor/Compilation/RoslynCompilationService.cs @@ -202,12 +202,20 @@ namespace Microsoft.AspNet.Mvc.Razor.Compilation // Check for the pdb writer component that roslyn uses to generate pdbs const string SymWriterGuid = "0AE2DEB0-F901-478b-BB9F-881EE8066788"; - return Marshal.GetTypeFromCLSID(new Guid(SymWriterGuid)) != null; + 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; } + + return false; } } }