-1

Since I put my App.razor's @code into an App.razor.cs file, Visual Studio stuffed this crap into my .csproj file. Removing it gives these compile errors: depiction of diff and compile errors

Here's the contents App.razor, just in case:

    using MyProject.Client.Services;
    using MyProject.Data;
    using System.Data;
    using System.Text;
    
    namespace MyProject.Components;

    public partial class App : ComponentBase {
        [Inject]
        private ServerDbAccess Db { get; set; } = null!;
        [Inject]
        private ServerSessionData SessionData { get; set; } = null!;

        protected async override Task OnInitializedAsync() {
            await base.OnInitializedAsync();

            IDbConnection dbCon = await this.Db.ConnectDb_Async();

            await this.SessionData.Load_Async( dbCon );
        }
    }

Any idea what's going on?

3
  • No Repro. Do a Build|Clean, restart VS, Build|Rebuild. Commented Jul 14 at 21:15
  • I've tried deleting bin and obj for each project in the solution between a VS restart. I assume that's about the same thing? Commented Jul 14 at 21:42
  • Yes, more or less the same. But as I sad, no repro. There is something missing in the post. Create a scratch project and do it again. Then compare. Commented Jul 15 at 5:52

1 Answer 1

0

Despite the confusing output information, it seems the issue was simply a missing using (using Microsoft.AspNetCore.Components;), which wasn't being caught because of the way the compilation was working before. I wasn't getting the missing reference alert in the IDE until I reloaded after cleaning the project. Possibly an IDE bug?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.