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.

Null reference exception on full framework

See original GitHub issue

I’m using embedded files, latest beta1 version, on net461 full framework, migrating to netcore2.0 but in progress and need to work in both frameworks. Always getting error: System.NullReferenceException HResult=0x80004003 Message=Object reference not set to an instance of an object. Source=RazorLight StackTrace: at RazorLight.Compilation.DefaultMetadataReferenceManager.Resolve(DependencyContext dependencyContext) at RazorLight.Compilation.DefaultMetadataReferenceManager.Resolve(Assembly assembly) at RazorLight.Compilation.RoslynCompilationService.EnsureOptions() at RazorLight.Compilation.RoslynCompilationService.get_ParseOptions() at RazorLight.Compilation.RoslynCompilationService.CreateSyntaxTree(SourceText sourceText) at RazorLight.Compilation.RoslynCompilationService.CreateCompilation(String compilationContent, String assemblyName) at RazorLight.Compilation.RoslynCompilationService.CompileAndEmit(IGeneratedRazorTemplate razorTemplate) at RazorLight.Compilation.RoslynCompilationService.CompileAsync(IGeneratedRazorTemplate razorTemplate) at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at RazorLight.Compilation.TemplateFactoryProvider.<CompileAsync>d__10.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at RazorLight.Compilation.TemplateFactoryProvider.<CreateFactoryAsync>d__8.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at RazorLight.RazorLightEngine.<CompileTemplateAsync>d__14.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at RazorLight.RazorLightEngine.<CompileRenderAsync>d__11.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
colinbullcommented, Feb 22, 2018

Humm, this looks like there is an assembly version issue possibly, have you checked which nuget packages you are referencing and binding redirects? It looks like at runtime you are getting an older / different version of the assembly containing MetadataReader. I’m running fine on net471.

@glikoz with your permission I’d like to send a PR, to see if we can get your solution, published in the nuget package.

1reaction
bottomupcommented, Feb 20, 2018

Same issue!

Read more comments on GitHub >

github_iconTop Results From Across the Web

NullReferenceException Class (System)
A NullReferenceException exception is thrown by a method that is passed null . Some methods validate the arguments that are passed to them....
Read more >
c# - What is a NullReferenceException, and how do I fix it?
The runtime throwing a NullReferenceException always means the same thing: you are trying to use a reference, and the reference is not ...
Read more >
What is NullReferenceException in C#? - Code Maze
In C#, a NullReferenceException occurs when we try to access a variable whose value has not been set or has been set to...
Read more >
Object Reference Not Set to an Instance of an Object
This infamous and dreaded error message happens when you get a NullReferenceException. This exception is thrown when you try to access a member—for...
Read more >
Debugging System.NullReferenceException - elmah.io Blog
The exception happens when you try to invoke a reference that you were expecting to point to an object but in fact, points...
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