diff --git a/src/Framework/Framework/Compilation/Directives/MarkupDirectiveCompilerPipeline.cs b/src/Framework/Framework/Compilation/Directives/MarkupDirectiveCompilerPipeline.cs index 2475e84115..9c854e3f9b 100644 --- a/src/Framework/Framework/Compilation/Directives/MarkupDirectiveCompilerPipeline.cs +++ b/src/Framework/Framework/Compilation/Directives/MarkupDirectiveCompilerPipeline.cs @@ -24,7 +24,9 @@ public MarkupDirectiveCompilerPipeline(IAbstractTreeBuilder treeBuilder, IContro public MarkupPageMetadata Compile(DothtmlRootNode dothtmlRoot, string fileName) { - var directivesByName = dothtmlRoot.Directives.GroupBy(d => d.Name, StringComparer.OrdinalIgnoreCase).ToDictionary(d => d.Key, d => (IReadOnlyList)d.ToList()); + var directivesByName = dothtmlRoot.Directives + .GroupBy(d => d.Name, StringComparer.OrdinalIgnoreCase) + .ToDictionary(d => d.Key, d => (IReadOnlyList)d.ToList(), StringComparer.OrdinalIgnoreCase); var resolvedDirectives = new Dictionary>(); diff --git a/src/Tests/Runtime/ControlTree/DefaultControlTreeResolver/ViewModelDirectiveTest.cs b/src/Tests/Runtime/ControlTree/DefaultControlTreeResolver/ViewModelDirectiveTest.cs index fe9297ba56..4176eb21b9 100644 --- a/src/Tests/Runtime/ControlTree/DefaultControlTreeResolver/ViewModelDirectiveTest.cs +++ b/src/Tests/Runtime/ControlTree/DefaultControlTreeResolver/ViewModelDirectiveTest.cs @@ -88,5 +88,16 @@ public void ResolvedTree_ViewModel_TypeFromGlobalImportedNamespace() Assert.IsFalse(root.Directives.Any(d => d.Value.Any(dd => dd.DothtmlNode.HasNodeErrors))); Assert.AreEqual(typeof(TestViewModel), root.DataContextTypeStack.DataContextType); } + + [TestMethod] + [DataRow("@viewModel")] + [DataRow("@viewmodel")] + public void ResolvedTree_ViewModel_DirectiveIdentifier_CaseInsensitivity(string directive) + { + var root = ParseSource($"{directive} System.String"); + + Assert.IsFalse(root.Directives.Any(d => d.Value.Any(dd => dd.DothtmlNode.HasNodeErrors))); + Assert.AreEqual(typeof(string), root.DataContextTypeStack.DataContextType); + } } }