Describe the bug
I'm Learning on razorlight, and when using foreach to traverse the type List<Dictionary<string, string>>, an exception is thrown.
System.AggregateException:“One or more errors occurred. (Failed to compile generated Razor template. "Failed to find type or namespace name 'Dictionary,' (Is a using directive or assembly reference missing?)"
To Reproduce
call the function:
var result = engine.CompileRenderStringAsync(key, templete, dict).Result;
Expected behavior
I think it compiles successfully, Dictionary<string,string> is a .NET type in namespace System.Collections.Generic
Information (please complete the following information):
Describe the bug I'm Learning on razorlight, and when using foreach to traverse the type List<Dictionary<string, string>>, an exception is thrown.
System.AggregateException:“One or more errors occurred. (Failed to compile generated Razor template. "Failed to find type or namespace name 'Dictionary,' (Is a using directive or assembly reference missing?)"
To Reproduce call the function: var result = engine.CompileRenderStringAsync(key, templete, dict).Result;
Expected behavior I think it compiles successfully, Dictionary<string,string> is a .NET type in namespace System.Collections.Generic
Information (please complete the following information):
Additional context // init
var engine = new RazorLightEngineBuilder().UseMemoryCachingProvider().Build();
// model data List<Dictionary<string, string>> model = new(); model.Add(dict1);// add more dict ...
// template
string temp = "@foreach(Dictionary<string,string> dict in Model){<h1>@dict[\"a\"]</h1><h1>@dict[\"b\"]</h1>}";
// run ,exception throw
string result = engine.CompileRenderStringAsync("key1", tmp, dict).Result;