Closed pascalberger closed 4 years ago
@mholo65 what were your thoughts on how best to proceed with this one?
Just a null check would be ok. AFAIK, you'll only hit this with unit tests. It's a known issue that entry assembly will be null when running unit tests.
@mholo65 what about when running under the context of Cake, would you foresee any issues there?
Nope, no issue. The entry assembly will be Cake.exe. I've successfully tested this with Cake for a PoC for Xamarin team (Redth?). I can add Cake integration tests also.
This seems to be only an issue if target framework in consuming application is net461
, with netstandard2.0
, netcoreapp2.1
or netcoreapp3.1
the error didn't occur
Using Gazorator in an XUnit test case and running from Visual Studio Test Explorer as part of https://github.com/cake-contrib/Cake.Issues.Reporting.Generic/pull/276 leads to a null reference exception:
Checking for
entryAssembly != null
andentryAssembly.Location != null
in https://github.com/mholo65/gazorator/blob/develop/src/Gazorator/Scripting/RazorContentGenerator.cs#L57 worked around the issue.