Hi,
when work with Framework 4.6.2 , it give error like
Attempted to access an element as a type incompatible with the array
while accessing engine object.
here is my besic code
var viewsPath = Path.GetFullPath(_emailNotificationSettings.EmailTemplatePath);
var engines = new ViewEngineCollection
{
new FileSystemRazorViewEngine(viewsPath)
};
Error in details:
{
"message": "An error has occurred.",
"exceptionMessage": "Attempted to access an element as a type incompatible with the array.",
"exceptionType": "System.ArrayTypeMismatchException",
"stackTrace": " at System.Collections.Generic.List`1.Insert(Int32 index, T item)\r\n at System.Collections.ObjectModel.Collection`1.InsertItem(Int32 index, T item)\r\n at System.Web.Mvc.ViewEngineCollection.InsertItem(Int32 index, IViewEngine item)\r\n at System.Collections.ObjectModel.Collection`1.Add(T item)\r\n at Services.Notifications.EmailTemplates.BookingConfirmations(PropertyBookResult bookResult) ....