Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest version (0.9.1) results in many compile errors #83

Open
jtsom-do opened this issue Jan 3, 2025 · 4 comments
Open

Latest version (0.9.1) results in many compile errors #83

jtsom-do opened this issue Jan 3, 2025 · 4 comments

Comments

@jtsom-do
Copy link

jtsom-do commented Jan 3, 2025

I updated a .Net 8 project that was using 0.8.1 to the latest 0.9.1, and when the project is compiled, there are a ton of errors of the kind:

error CS0103: The name 'Slices' does not exist in the current context

Sample line where the error is generated:

var slice = Slices.Rx.ExportPrescriptionPDF.Create(prescriptionDetail);

I am also seeing several warnings about analyzers and source generators:

CSC : warning CS9057: The analyzer assembly 'e:\.nuget\packages\razorslices\0.9.1\analyzers\dotnet\cs\RazorSlices.SourceGenerator.dll' references version '4.12.0.0' of the 
 compiler, which is newer than the currently running version '4.11.0.0'.
CSC : warning RSG002: TargetPath not specified for additional file: E:\source\repos\MyApp.DocGen\DocGen.Services\bin\Debug\net8.0\Slices\Rx\ExportPrescription PDF.cshtml.

The RSG002 looks to be every .cshtml file that is being used as a slice.

Backing down to 0.8.1 clears the errors.

Looks like the SourceGenerator isn't working? Also, this is using VSCode (with the C# Sdk). Opening the project using VS2022 did return the same errors, but after several clean/rebuild cycles, it seems to fix the problem. (Yes, I've done a dotnet clean dotnet build several times.

Thanks

@jtsom-do jtsom-do closed this as completed Jan 3, 2025
@jtsom-do jtsom-do reopened this Jan 3, 2025
@xDKomar
Copy link

xDKomar commented Jan 8, 2025

I also have this issue after updating from 0.8.1 to 0.9.1
In my case several clean/rebuild cycles do not help. Only backing down to 0.8.1

@DamianEdwards
Copy link
Owner

Hmmm. Hard to diagnose what's going on here unless the compiler version being referenced is enough to disable the source generator running.

What version of the .NET SDK are you running?

@xDKomar
Copy link

xDKomar commented Jan 11, 2025

dotnet --info

.NET SDK:
 Version:           8.0.401
 Commit:            811edcc344
 Workload version:  8.0.400-manifests.b6724b7a
 MSBuild version:   17.11.4+37eb419ad

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  14.5
 OS Platform: Darwin
 RID:         osx-arm64
 Base Path:   /usr/local/share/dotnet/sdk/8.0.401/

.NET workloads installed:
Configured to use loose manifests when installing new manifests.
There are no installed workloads to display.

Host:
  Version:      8.0.8
  Architecture: arm64
  Commit:       08338fcaa5

.NET SDKs installed:
  6.0.101 [/usr/local/share/dotnet/sdk]
  7.0.100 [/usr/local/share/dotnet/sdk]
  8.0.401 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  x64   [/usr/local/share/dotnet/x64]
    registered at [/etc/dotnet/install_location_x64]

And a part of .csproj file:

<PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Google.Apis.Auth" Version="1.45.0" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.5" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.20" />
    <PackageReference Include="Microsoft.AspNetCore.SignalR.StackExchangeRedis" Version="7.0.16" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.3" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.3">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.3">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="7.0.0" />
    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.3" />
    <PackageReference Include="RazorSlices" Version="0.8.1" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
    <PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.2.3" />
  </ItemGroup>

@jtsom
Copy link

jtsom commented Jan 11, 2025

I have .Net 9 installed, but the project is .Net 8 (whatever the latest is). On Windows. The project has a global.json to fix it to 8 also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants