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

Multiline item values get truncated #390

Closed
kzu opened this issue Sep 17, 2024 · 2 comments · Fixed by #392 or #420
Closed

Multiline item values get truncated #390

kzu opened this issue Sep 17, 2024 · 2 comments · Fixed by #392 or #420
Labels
bug Something isn't working

Comments

@kzu
Copy link
Member

kzu commented Sep 17, 2024

Whether these are from project properties or direct constant items, when they are presisted via the editorconfig used for analyzer options, causes this issue.

The persistence in editorconfig does not escape newlines in any way, causing only the first line to be visible to analyzers.

Back this issue
Back this issue

@kzu kzu added the bug Something isn't working label Sep 17, 2024
kzu added a commit that referenced this issue Sep 17, 2024
Just like we do for semicolon-separated values (encoding them prior to persistence to editorconfig/analyzer config), we now encode newlines as `\n` and decode them prior to emitting source code.

This makes previously failing scenarios work (i.e. project properties) as well as fixing previously working ones in AssemblyInfo generator (i.e. Description property).

Fixes #390
kzu added a commit that referenced this issue Sep 17, 2024
Just like we do for semicolon-separated values (encoding them prior to persistence to editorconfig/analyzer config), we now encode newlines as `\n` and decode them prior to emitting source code.

This makes previously failing scenarios work (i.e. project properties) as well as fixing previously working ones in AssemblyInfo generator (i.e. Description property).

Fixes #390
@kzu kzu closed this as completed in #392 Sep 17, 2024
@kzu kzu closed this as completed in 437436b Sep 17, 2024
@OoLunar
Copy link

OoLunar commented Oct 7, 2024

I still seem to be having this problem:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <Nullable>enable</Nullable>
    <OutputType>Exe</OutputType>
    <ProjectRoot>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), "Tomoe.sln"))</ProjectRoot>
    <RepositoryUrl>https://github.com/OoLunar/Tomoe</RepositoryUrl>
    <SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
    <TargetFramework>net8.0</TargetFramework>
    <Version>6.0.5</Version>
    <GenerateDocumentationFile>true</GenerateDocumentationFile>
    <ProjectFile>$([System.IO.File]::ReadAllText("/home/lunar/Code/OoLunar/Tomoe/src/Tomoe.csproj"))</ProjectFile>
  </PropertyGroup>
  <ItemGroup>
    <None Include="$(ProjectRoot)/res/config.json" CopyToOutputDirectory="PreserveNewest" />
    <PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
    <PackageReference Include="Humanizer" Version="2.14.1" />
    <PackageReference Include="LiveChartsCore.SkiaSharpView" Version="2.0.0-rc3.3" />
    <PackageReference Include="LiveChartsCore" Version="2.0.0-rc3.3" />
    <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.11.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
    <PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="8.0.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
    <PackageReference Include="Npgsql" Version="8.0.4" />
    <PackageReference Include="Serilog" Version="4.0.2" />
    <PackageReference Include="Serilog.Extensions.Hosting" Version="8.0.0" />
    <PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
    <PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
    <PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
    <PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.8" />
    <PackageReference Include="System.Text.Json" Version="8.0.4" />
    <PackageReference Include="ThisAssembly" Version="2.0.3">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <ProjectReference Include="$(ProjectRoot)/libs/DSharpPlus/DSharpPlus.Commands/DSharpPlus.Commands.csproj" />
    <ProjectReference Include="$(ProjectRoot)/libs/XMLDocs.NET/src/XmlDocs.NET.csproj" />
    <ProjectProperty Include="TargetFramework" />
    <ProjectProperty Include="Version" />
    <ProjectProperty Include="RepositoryUrl" />
    <ProjectProperty Include="ProjectFile" />
    <ProjectProperty Include="ProjectRoot" />
  </ItemGroup>
</Project>

Where the value of Assembly.Project.ProjectFile becomes |<Project Sdk="Microsoft.NET.Sdk">

@kzu
Copy link
Member Author

kzu commented Oct 7, 2024

Newlines aren't supported in analyzer settings/options. Is the issue the extra | character at the beginning? Which version are you using?

I added a test and additional docs and support for specifying a Comment attribute on your project property element, so you can workaround the invalid XML issue.

See #420

kzu added a commit that referenced this issue Oct 8, 2024
This can help workaround the issue of the value having invalid content for an XML summary element (i..e. the value has XML).

Further fixes #390
kzu added a commit that referenced this issue Oct 8, 2024
This can help workaround the issue of the value having invalid content for an XML summary element (i..e. the value has XML).

Further fixes #390
@devlooped devlooped locked and limited conversation to collaborators Nov 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
2 participants