Skip to content

PackageScribanIncludeSource produces a lot of warnings #660

Description

@zvirja

Follow up on #657

I am using Scriban 7.0.0 with PackageScribanIncludeSource and it produces a lot of warnings:

Warning CS8669 : The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

That happens even when I enable nullability for the csproj:

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <TargetFramework>netstandard2.0</TargetFramework>
        <Nullable>enable</Nullable>
        <LangVersion>12</LangVersion>
        
        <PackageScribanIncludeSource>true</PackageScribanIncludeSource>
        <DefineConstants>$(DefineConstants);SCRIBAN_NO_ASYNC</DefineConstants>
    </PropertyGroup>

    <ItemGroup>
      <PackageReference Include="Scriban" Version="7.0.0" IncludeAssets="Build" />
    </ItemGroup>

</Project>

In our project we have warnings as errors, so it failing the build entirely. For now I use NoWarn as a workaround, but it doesn't feel as a sustainable solution.

I believe that the fix should be including explicit #nullable directive conditionally if we embed source code. Or maybe there is something better :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions