NullReferenceException in RazorLight.Compilation.RoslynCompilationService.IsAssemblyDebugBuild
See original GitHub issueI’m using RazorLight v2.0.0-alpha3 and I’m getting a NRE when I try to render a razor template from my unit test project.
{System.NullReferenceException: Object reference not set to an instance of an object.
at RazorLight.Compilation.RoslynCompilationService.IsAssemblyDebugBuild(Assembly assembly)
at RazorLight.Compilation.RoslynCompilationService..ctor(IMetadataReferenceManager referenceManager)
at RazorLight.EngineFactory.Create(RazorLightProject project, RazorLightOptions options)
at RazorLight.EngineFactory.ForEmbeddedResources(Type rootType)
The constructor of the RoslynCompilationService is executing this line of code:
IsAssemblyDebugBuild(OperatingAssembly);
The OperatingAssembly property returns the result from Assembly.GetEntryAssembly(), but in my case this returns null. Because of this the IsAssemblyDebugBuild method throws a NRE:
return assembly.GetCustomAttributes(false) ==> assembly == null
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Failed to compile generated Razor template ...
I had the exact same issue, but only within my published application. While debugging the worker service i didn't get the error message....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@toddams - we are getting this same error with .net 4.6.2. Your sandbox uses Dependency Injection 2.0.0.0 but the version 2.0.3 or higher have the error which you seem to have fixed in #159 (669cb741998b6248d7ccfa3f9da2d25acdeaa2f8)
Our project is awaiting your Beta2 release. Can you please provide an ETA?
Any news on this?