Код: Выделить всё
// Get the path to the directory containing views
var viewsPath = Path.GetFullPath(@"..\..\Views");
var engines = new ViewEngineCollection();
engines.Add(new FileSystemRazorViewEngine(viewsPath));
var service = new EmailService(engines);
Неожиданно выдается следующая ошибка:
Произошло System.ArrayTypeMismatchException HResult=-2146233085
Сообщение=Попытка доступа к элементу как типу, несовместимому с массивом
. Source=mscorlib StackTrace:
at System.Collections.Generic.List`1.Insert(Int32 index, T item) InnerException:
Точнее, оно выдается во время добавления FileSystemRazorViewEngine в ViewEngineCollection. FileSystemRazorViewEngine является производным от IViewEngine, а ViewEngineCollection является производным от Collection.
А вот stacktrace:
mscorlib.dll!System.Collections.Generic.List.Insert(int
index, System.__Canon item) + 0x3e байт
System.Web.Mvc.dll!System.Web.Mvc.ViewEngineCollection.InsertItem(int
index, Элемент System.Web.Mvc.IViewEngine) + 0x89 байт
Не могу понять, что вызывает исключение.
Подробнее здесь: https://stackoverflow.com/questions/335 ... -thrown-du
Мобильная версия