I've got a project, and expecting for there to be a fair number of database entities to account for, I modified the project and moved pages into folders. With a little bit of manual modifications, I was able to get the project up and running again, but in Visual Studio it now reports errors for those pages in sub folders like this:
|Error|CS0115|'AddDrayageDestination.OnInitializedAsync()': no suitable method found to override|DSLQuotes.Client|D:\Folder\Project\Client\Pages\Destinations\AddDrayageDestination.razor.cs|35|Active|
There must be some last reference that I failed to change, any suggestions?
I'd be happy to work with somebody, anybody, if we were able to work out some kind of standard procedure with a set of steps for moving pages into folders, so we could make this process more reliable.
Thoughts, anybody?
Hi @devdude,
Folders in Blazor map to namespaces. When you move the AddDrayageDestination.razor to the Destinations folder its generated class becomes AppName.Client.Pages.Destinations.AddDrayageDestination
. The codebehind file AddDrayageDestination.razor.cs probably doesn't account for that. Open that file and change the namespace so it matches. It should be something like
namespace AppName.Client.Pages.Destinations
{
public partial class AddDrayageDestination
{
}
}
Yes, that's exactly what I have:
namespace AppName.Client.Pages.Destinations
{
public partial class AddDrayageDestination
{
}
}
But it's always this function that has the error:
protected override async Task OnInitializedAsync()
{
drayageDestination = new AppName.Server.Models.DBName.DrayageDestination();
}
Visual studio says "no suitable method found to override".
But the app does compile and run in Radzen.
I just noticed another error hidden among the messages in Visual Studio 22, it says:
CSC : warning CS9057: The analyzer assembly 'C:\Program Files\dotnet\sdk\8.0.204\Sdks\Microsoft.NET.Sdk.Razor\source-generators\Microsoft.CodeAnalysis.Razor.Compiler.SourceGenerators.dll' references version '4.9.0.0' of the compiler, which is newer than the currently running version '4.8.0.0'
There is a chance you are using a preview version of Visual Studio which has issues. Try updating your version of use the official one instead of the preview.