StackExchange / StackExchange.Precompilation

Roslyn based csc.exe and aspnet_compiler.exe replacement with metaprogramming hooks for ASP.NET MVC projects from the pre-DNX era
MIT License
155 stars 37 forks source link

Runtime error: Windows PDB writer is not available -- could not find Microsoft.DiaSymReader.Native.x86.dll #10

Open sirajmansour-infotrack opened 7 years ago

sirajmansour-infotrack commented 7 years ago

After changing our build process to use the StackExchange precompiler, everything builds successfully and our build time has drastically improved thanks to this great compiler.

However we're seeing this runtime error on some of our environments as soon as we started using the stackexchange precompiler. Oddly enough, on the same environments we deploy the same application twice but with different configs, one works fine and the other is just broken because of this this runtime error : Windows PDB writer is not available -- could not find Microsoft.DiaSymReader.Native.x86.dll.

We generate and keep PDB files for our test and staging environments.

One theory is that one of the applications is deployed in IIS as a Website, and the other as a Web Application, but both exactly under the same privileges, Application Pool, settings, etc... But we couldn't prove this exactly either.

We're not very sure the cause behind this, in some cases re-installing visual c++ 2015 redistributable on the server fixed the issue, but in other cases it didn't.

Any help on this would be appreciated.

m0sa commented 7 years ago

Are you sure you're using your pre-compiled views? You shouldn't get that at runtime unless you're trying to emit a PDB stream, which would be if you're hitting the RoslynRazorViewEngine instead of the PrecompiledViewEngine?

A complete stack trace of the exception would also be very helpful.

sirajmansour-infotrack commented 7 years ago

Thanks for the insight, i'll look more into it. It is very random the way it happens and no consistency in the way the issue appears.

In our global.asax.cs we definitely have

  ViewEngines.Engines.Clear();
#if !DEBUG
            // use precompiled engine first (supports some C# 6),
            ViewEngines.Engines.Add(new PrecompiledViewEngine(typeof(Controllers.HomeController).Assembly));
#endif
            ViewEngines.Engines.Add(new RoslynRazorViewEngine());

We use TC as our build server, release mode is chosen in all our release configs.

Could it be that for some reason the PrecompiledViewEngine fails to find the view, so it falls back to the RoslynRazorViewEngine one ?.

I suspected the Virtual application path could be behind the problem when trying to locate views, but i believe it is not possible since that issue would always show up then, but instead it doesn't.

DaniilSokolyuk commented 6 years ago

Get same problem on production after 7 days of work

System.Web.HttpParseException (0x80004005): error CS0041: Unexpected error writing debug information -- 'The version of Windows PDB writer is older than required: 'diasymreader.dll'' at StackExchange.Precompilation.RoslynRazorViewEngine.CompileToAssembly(WebPageRazorHost host, SyntaxTree syntaxTree) at StackExchange.Precompilation.RoslynRazorViewEngine.GetTypeFromVirtualPathNoCache(String virtualPath) at StackExchange.Precompilation.RoslynRazorViewEngine.GetTypeFromVirtualPath(String virtualPath) at StackExchange.Precompilation.RoslynRazorViewEngine.CreateView(ControllerContext controllerContext, String viewPath, String masterPath) at System.Web.Mvc.VirtualPathProviderViewEngine.FindView(ControllerContext controllerContext, String viewName, String masterName, Boolean useCache) at StackExchange.Profiling.Mvc.ProfilingViewEngine.<>cDisplayClass4.b3() at StackExchange.Profiling.Mvc.ProfilingViewEngine.Find(String name, Func1 finder, Boolean isPartial) at System.Web.Mvc.ViewEngineCollection.<>c__DisplayClass6.<FindView>b__5(IViewEngine e) at System.Web.Mvc.ViewEngineCollection.Find(Func2 lookup, Boolean trackSearchedPaths) at System.Web.Mvc.ViewEngineCollection.Find(Func2 cacheLocator, Func2 locator) at System.Web.Mvc.ViewResult.FindView(ControllerContext context) at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 filters, ActionResult actionResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) at System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) at System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) at System.Web.HttpApplication.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar)

Full Trace:

RaiseOnError at offset 126 in file:line:column :0:0 RecordError at offset 916 in file:line:column :0:0 RecordError at offset 703 in file:line:column :0:0 ResumeSteps at offset 536 in file:line:column :0:0 ResumeStepsFromThreadPoolThread at offset 48 in file:line:column :0:0 OnAsyncHandlerCompletion at offset 421 in file:line:column :0:0

b__3 at offset 22 in file:line:column :0:0 b__0 at offset 34 in file:line:column :0:0 SafeWrapCallback at offset 113 in file:line:column :0:0 QueueSynchronous at offset 169 in file:line:column :0:0 Sync at offset 119 in file:line:column :0:0 Sync at offset 98 in file:line:column :0:0 ExecuteAsynchronousCallback at offset 86 in file:line:column :0:0 ExecuteAsynchronousCallback at offset 86 in file:line:column :0:0 ExecuteAsynchronousCallback at offset 94 in file:line:column :0:0 ExecuteAsynchronousCallback at offset 94 in file:line:column :0:0 ExecuteAsynchronousCallback at offset 94 in file:line:column :0:0 Execute at offset 74 in file:line:column :0:0 RunInternal at offset 354 in file:line:column :0:0 Run at offset 23 in file:line:column :0:0 ExecuteWithThreadLocal at offset 553 in file:line:column :0:0 ExecuteEntry at offset 152 in file:line:column :0:0 Dispatch at offset 421 in file:line:column :0:0