hoeyi / Ozym

A web-application for tracking personal finances. Built using Blazor, ASP.NET Core, and Entity Framework Core.
3 stars 0 forks source link

Compiler error related to generic component causes docker build to fail #237

Closed hoeyi closed 4 months ago

hoeyi commented 11 months ago

Describe the bug

Using the included Docker file to publish the app fails due to a builder error in Ozym.Web that does not occur when using Visual Studio to do the build.

To Reproduce Steps to reproduce the behavior:

  1. Pull source at commit 7c3c406.
  2. Change the working directory to the project root (where the Docker file lives).
  3. Run docker builder --tag 'sometag' .
  4. Build continues until RUN dotnet build Ozym.Web.csproj -c Release..., at which point the build starts, but fails due to compiler error CS0449 related to components inheriting from a generic type component.

Expected behavior

The build output should work using either dotnet build on the dev machine or for building the docker image. Interestingly, the compiler does not throw an error when building via Visual Studio or for tests, but does raise an error when viewing the base generic components for editing data (e.g., ModelComponent<T>).

Build tools

Visual Studio 17.7.2 .NET SDK 7.0.400

hoeyi commented 11 months ago

Looks similar to the issues described in this thread on @typeparam use in Blazor: https://github.com/dotnet/razor/issues/8572.

I confirmed the method described in this thread for temporarily resolving the issue works: .NET6 Blazor @typeparam where constraint ERROR RZ1017. The temporary fix for VS appears to have no affect on the docker build process.

hoeyi commented 10 months ago

I was able to resolve build error by updating the SDK version to 7.0.402 via the .NET 7 image: mcr.microsoft.com/dotnet/sdk:7.0.

hoeyi commented 9 months ago

Looks to be a bug in the 6.0 SDK, but is not expected to be resolved based on dotnet/razor#8770. Issue is resolved in versions 7.0 and 8.0.

hoeyi commented 9 months ago

Try to resolve this by updating the target runtime to .NET 8.0.