question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NullReferenceException in RazorLight.Compilation.RoslynCompilationService.IsAssemblyDebugBuild

See original GitHub issue

I’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:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
zagroscommented, Mar 28, 2018

@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?

1reaction
mattwhettoncommented, Apr 24, 2018

Any news on this?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found