Uchenna

ArgumentNullException: Value cannot be null. (Parameter 'source')

net Icon

System.ArgumentNullException

Value cannot be null. (Parameter 'source')

An unhandled exception occurred on line 95
93
        public string SourceMessage { get; set; }
94
95
        public int? SourceLineNumber => CodeSnippetLines.FirstOrDefault(e => e.IsHighlighted)?.LineNumber;
96
97
        public string StackTrace { get; set; }

Solution

In my specific case, I was trying to access an object that was null. So I just added a "?" conditional check to fix the issue.            
Feb 03, 2021 Anyone

2 replies


Ben

Nice work!

Uchenna

Thanks Ben ;)


Install the browser extension

Found this solution helpful? Try our extension for quick solutions to your .NET errors.

Chrome logo Add to Chrome - It's free