Skip to content

With Framework 4.6.2 it give error Attempted to access an element as a type incompatible with the array #169

@cpatel22

Description

@cpatel22

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) .... 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions