Get this error when returning view
-
This is driving me mad!!! My hobby project a net core 6 Web app was running perfectly until yesterday - I'm now getting this error message whenever I try and return a view. I've obviously done something but I can't for the life of me think what. I can't catch the error either it just bombs and shows this error in the browser - any ideas ? The app runs as a daemon on a Debian box.
MissingMethodException: Method not found: Microsoft.AspNetCore.Razor.Language.RazorConfiguration Microsoft.AspNetCore.Razor.Language.RazorConfiguration.Create(Microsoft.AspNetCore.Razor.Language.RazorLanguageVersion, System.String, System.Collections.Generic.IEnumerable`1)
Microsoft.AspNetCore.Mvc.Razor.Extensions.RazorPageDocumentClassifierPass..cctor()Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP
-
This is driving me mad!!! My hobby project a net core 6 Web app was running perfectly until yesterday - I'm now getting this error message whenever I try and return a view. I've obviously done something but I can't for the life of me think what. I can't catch the error either it just bombs and shows this error in the browser - any ideas ? The app runs as a daemon on a Debian box.
MissingMethodException: Method not found: Microsoft.AspNetCore.Razor.Language.RazorConfiguration Microsoft.AspNetCore.Razor.Language.RazorConfiguration.Create(Microsoft.AspNetCore.Razor.Language.RazorLanguageVersion, System.String, System.Collections.Generic.IEnumerable`1)
Microsoft.AspNetCore.Mvc.Razor.Extensions.RazorPageDocumentClassifierPass..cctor()Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP
At a guess, you've either updated some libraries, or the .NET SDK, and something is now outdated. Looking at the history[^], that method existed in the version of the code from November 2018: razor-compiler/RazorConfiguration.cs at 32ff07c6d4a8037c61a5c75c26fc5f805da19b3a · dotnet/razor-compiler · GitHub[^] But in March 2021, an optional parameter was added: razor-compiler/RazorConfiguration.cs at f26e545a6712f186c84ed4ed956927be8ab52af6 · dotnet/razor-compiler · GitHub[^] You have a library compiled against the 2018 version which is now running against the 2021 (or later) version. I suspect you've updated the Microsoft.AspNetCore.Razor.Language[^] package, but not updated the Microsoft.AspNetCore.Mvc.Razor.Extensions[^] package to match. However, it's possible that your project doesn't directly reference either of these packages, and they're being pulled in as a transitive dependency of another package instead. You may need to dig through the dependency tree of each NuGet package you've referenced.
-
At a guess, you've either updated some libraries, or the .NET SDK, and something is now outdated. Looking at the history[^], that method existed in the version of the code from November 2018: razor-compiler/RazorConfiguration.cs at 32ff07c6d4a8037c61a5c75c26fc5f805da19b3a · dotnet/razor-compiler · GitHub[^] But in March 2021, an optional parameter was added: razor-compiler/RazorConfiguration.cs at f26e545a6712f186c84ed4ed956927be8ab52af6 · dotnet/razor-compiler · GitHub[^] You have a library compiled against the 2018 version which is now running against the 2021 (or later) version. I suspect you've updated the Microsoft.AspNetCore.Razor.Language[^] package, but not updated the Microsoft.AspNetCore.Mvc.Razor.Extensions[^] package to match. However, it's possible that your project doesn't directly reference either of these packages, and they're being pulled in as a transitive dependency of another package instead. You may need to dig through the dependency tree of each NuGet package you've referenced.
Thanks Richard I updated the nuget packages and the problem disappeared - NuGet does bite me every now and then.
Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP