GithubHelp home page GithubHelp logo

Comments (8)

IGood avatar IGood commented on May 25, 2024 1

Thanks for providing all this great info!

I can confirm that I get errors in these versions

Microsoft Visual Studio Community 2022 (64-bit) - Current
Version 17.2.6

Microsoft Visual Studio Community 2022 (64-bit) - Preview
Version 17.3.0 Preview 1.1

I'll continue investigating. This bug makes me very sad.

from boilerplatezero.

IGood avatar IGood commented on May 25, 2024 1

Good news!

This is a known bug with a workaround that I found here - dotnet/wpf#6792 (comment)

	<Target Name="RemoveDuplicateAnalyzers" BeforeTargets="CoreCompile">
		<!-- Work around https://github.com/dotnet/wpf/issues/6792 -->
		<ItemGroup>
			<FilteredAnalyzer Include="@(Analyzer->Distinct())" />
			<Analyzer Remove="@(Analyzer)" />
			<Analyzer Include="@(FilteredAnalyzer)" />
		</ItemGroup>
	</Target>

from boilerplatezero.

graealex avatar graealex commented on May 25, 2024

Addendum:

private static readonly DependencyProperty FilenameProperty = Gen.Filename<string>();

causes similar "already contains a definition" errors. It's as if the generated code gets compiled twice.

from boilerplatezero.

IGood avatar IGood commented on May 25, 2024

Yikes! I haven't seen this problem before.
From what you've said - it does seem as if the code generation is happening 2x 🤔

Is there more information in the compiler output log? Perhaps details about file/line where each occurrence exists?

from boilerplatezero.

graealex avatar graealex commented on May 25, 2024

I have created a minimal test case that reproduces the issue:

  • Create a new WPF project (.NET 5)
  • Add boilerplatezero via Nuget
  • Add private static readonly DependencyProperty BlaBlaProperty = Gen.BlaBla<string>(); to MainWindow.xaml.cs
  • Compile fails with mentioned errors
  • Commit all to Github
  • Deleted the local repo
  • Cloned the repo from Github
  • Opened local repo with VS.2022, click "Build" - get the same errors

The repo is here: https://github.com/graealex/BpzWpfTestNuget

1>C:\Work\BpzWpfTestNuget\boilerplatezero\Bpz.Wpf.DependencyPropertyGenerator\bpz.DependencyProperties.g.cs(16,18,16,24): error CS0102: The type 'MainWindow' already contains a definition for 'BlaBla'
1>C:\Work\BpzWpfTestNuget\boilerplatezero\Bpz.Wpf.DependencyPropertyGenerator\bpz.DependencyProperties.g.cs(26,37,26,43): error CS0111: Type 'MainWindow.Gen' already defines a member called 'BlaBla' with the same parameter types

from boilerplatezero.

graealex avatar graealex commented on May 25, 2024

Addendum: the same project compiles fine without any errors in:

Microsoft Visual Studio Community 2022 (64-bit) - Preview
Version 17.3.0 Preview 2.0

The problematic version seems to be:

Microsoft Visual Studio Community 2022 (64-bit) - Current
Version 17.2.5

Updating to the newest preview version reintroduced the error:

Microsoft Visual Studio Community 2022 (64-bit) - Preview
Version 17.4.0 Preview 1.0

Really not sure what the culprit is.

from boilerplatezero.

graealex avatar graealex commented on May 25, 2024

build.detailed.log
build.diag.log

Also logs to the build process when launched from command line dotnet build --verbosity diag and dotnet build --verbosity detailed

from boilerplatezero.

IGood avatar IGood commented on May 25, 2024

Thank you, @graealex, for donating to support this project! You are very kind.

from boilerplatezero.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.