This is related to the discussion in #378 RazorSourceGenerator.GenerateCodeAsync(RazorLightProjectItem projectItem) and RazorSourceGenerator.CreateCodeDocumentAsync(RazorLightProjectItem projectItem) both accept a RazorLightProjectItem with the precondition that the .Exists property is true. Previously, when this precondition was not met, GenerateCodeAsync threw a TemplateNotFoundException while CreateCodeDoucmentAsync threw a InvalidOperationException. The exception language and type (in GenerateCodeAsync) made it sound like these methods are trying to "look up" a template, when in reality they are only checking the Exists property on the project item. These changes clarify the behavior of these methods and make the exception type consistent.
This is related to the discussion in #378
RazorSourceGenerator.GenerateCodeAsync(RazorLightProjectItem projectItem)
andRazorSourceGenerator.CreateCodeDocumentAsync(RazorLightProjectItem projectItem)
both accept aRazorLightProjectItem
with the precondition that the.Exists
property is true. Previously, when this precondition was not met,GenerateCodeAsync
threw aTemplateNotFoundException
whileCreateCodeDoucmentAsync
threw aInvalidOperationException
. The exception language and type (inGenerateCodeAsync
) made it sound like these methods are trying to "look up" a template, when in reality they are only checking theExists
property on the project item. These changes clarify the behavior of these methods and make the exception type consistent.