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

MSBuild Task target too late? #674

Closed
OneCyrus opened this issue May 23, 2022 · 4 comments · Fixed by #675
Closed

MSBuild Task target too late? #674

OneCyrus opened this issue May 23, 2022 · 4 comments · Fixed by #675
Labels
Milestone

Comments

@OneCyrus
Copy link

I really like the MSBuild task through the nuget package. This makes it very easy to have csharpier enabled in a project. It works almost perfectly except we are facing an issue when debugging and csharpier changes the code. The breakpoints fail as we have code changes after "building". Maybe csharpier can be run earlier than TargetBefore="Build" to solve this? any idea?

image

@belav
Copy link
Owner

belav commented May 23, 2022

It was setup to run before Build, but looking at a log of the build output, I could see that is was running after everything else and I reproduced the problem you were seeing with breakpoints not being hit properly.
Switching it to run before CoreCompile appears to have resolved the issue.

Thanks for reporting the problem!

belav added a commit that referenced this issue May 23, 2022
@belav belav added this to the 0.17.0 milestone May 23, 2022
@OneCyrus
Copy link
Author

OneCyrus commented Oct 4, 2022

we still run into this bug from time to time. not sure if it has anything to do with multiple projects. I'm trying to find a good way to reproduce it. not sure if anything has changed as I think it worked perfectly after the 0.17.0 release.

@belav any idea about a regression here?

@belav
Copy link
Owner

belav commented Oct 5, 2022

@OneCyrus there haven't been any changes to the MSBuild side of things since 0.17.0. The new caching in CSharpier did cause some issues, but those were exceptions that would have looked quite a bit different than this problem. If there is an issue with the caching causing CSharpier to not format a file because it believes it is already formatted - then I don't believe that would result in the source code looking different from what was used to compile.

The build output should give you an indication of what CSharpier is doing, which may help.

@OneCyrus
Copy link
Author

OneCyrus commented Oct 6, 2022

just did a very simple reproduction.

  1. Clone a hello world repo (https://github.com/NamAdonis/HelloWorld.git)
  2. Add CSharpier.MsBuild to the project
  3. Wrap line for Console.WriteLine
  4. Set Breakpoint to line below (Console.ReadLine)
  5. Execute (F5) and see that breakpoint is not active anymore

Screenrecording:
csharpier

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