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

Fix console mode #9094

Merged
merged 47 commits into from Sep 12, 2023
Merged

Fix console mode #9094

merged 47 commits into from Sep 12, 2023

Conversation

Forgind
Copy link
Member

@Forgind Forgind commented Aug 2, 2023

Fixes #9079

Context

First stab at taking into account console mode when writing error messages as part of a user asking for a particular property/item/target result. If we can't verify that the console is VT-compatible, we fall back to just printing things out with their default coloration. (Though not perfect, I think this is an unimportant enough scenario, that I don't think it's worth worrying about.)

Changes Made

Testing

Notes

Forgind and others added 30 commits May 18, 2023 16:43
Printing properties or items is much more complicated than might be supposed at face value. When creating a Project, we get things like ProjectItems and ProjectProperties; after the build, we get ProjectItemInstances and ProjectPropertyInstances. Properties aren't too bad because we can use a delegate to abstract over that, but ProjectInstances have ProjectItemInstances with ProjectMetadataInstances, which is too many layers of nesting to cleanly abstract that in a delegate, hence two separate helper functions for those.
...when getting evaluation results
@Forgind
Copy link
Member Author

Forgind commented Aug 2, 2023

Since the other PR is still open, do you want to fix this problem in there?

My personal preference is to fix it in a separate (i.e., this) PR, mostly because if I move these changes to that PR, it'd need to be reviewed more and probably need at least one or two more changes, and I'd rather it go in 🙂

@Forgind
Copy link
Member Author

Forgind commented Aug 2, 2023

I can move it over there if you want me to, though.

Copy link
Member

@JanKrivanek JanKrivanek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have couple minor comments for consideration.

The main things I'd like to see addressed:

src/Build/BackEnd/Client/MSBuildClient.cs Outdated Show resolved Hide resolved
src/Build/Logging/SimpleErrorLogger.cs Outdated Show resolved Hide resolved
src/Build/Logging/SimpleErrorLogger.cs Outdated Show resolved Hide resolved
src/Framework/NativeMethods.cs Outdated Show resolved Hide resolved
src/Build/Logging/SimpleErrorLogger.cs Outdated Show resolved Hide resolved
@Forgind
Copy link
Member Author

Forgind commented Aug 3, 2023

Member

I have couple minor comments for consideration.

The main things I'd like to see addressed:

  • Prevent merge mess, by either basing this on your other branch, or by first waiting for that other PR to go in (and then resolving here)

100% agree. My plan is to wait until the other PR is in, then restart the merge, and I believe it will drop all the prior commits (and make your life a lot easier!)

Which loggers are you thinking of? The only loggers that I think are potentially susceptible to this sort of problem are this new logger (fixed in this PR), the terminal logger (fixed in one of my previous PRs), and the console logger, but I asked about fixing the console logger in #9079, and rainersigwald suggested it doesn't need fixing. I'm fine with trying to fix it or not fix it as the two of you agree 🙂

@JanKrivanek
Copy link
Member

Which loggers are you thinking of? The only loggers that I think are potentially susceptible to this sort of problem are this new logger (fixed in this PR), the terminal logger (fixed in one of my previous PRs), and the console logger, but I asked about fixing the console logger in #9079, and rainersigwald suggested it doesn't need fixing. I'm fine with trying to fix it or not fix it as the two of you agree 🙂

Those are the loggers I had in mind. If all are already addressed separately - than we're good

Copy link
Member

@JanKrivanek JanKrivanek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good (just marking it as not subject for merging so that it doesn't get merged by anybody else prior the other PR is in and conflicts resolved)

Please reconsider what win32 api details needs to be exposed beyond boundaries of the NativeMethods

@Forgind
Copy link
Member Author

Forgind commented Aug 4, 2023

Please reconsider what win32 api details needs to be exposed beyond boundaries of the NativeMethods

That's fair. I guess I was thinking about if a user happens to be familiar with the wind32 API already...but how many people actually are? I added an enum.

@Forgind
Copy link
Member Author

Forgind commented Aug 15, 2023

@JanKrivanek, diff looks a lot cleaner now, so I removed the do-not-merge label.

@JanKrivanek
Copy link
Member

@JanKrivanek, diff looks a lot cleaner now, so I removed the do-not-merge label.

Thanks for all the adjustments! Looks good to go to me!

Copy link
Contributor

@rokonec rokonec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I have few opinionated/nit comments.

src/Build/Logging/SimpleErrorLogger.cs Outdated Show resolved Hide resolved
src/Build/Logging/SimpleErrorLogger.cs Outdated Show resolved Hide resolved
src/Framework/NativeMethods.cs Outdated Show resolved Hide resolved
@Forgind
Copy link
Member Author

Forgind commented Sep 7, 2023

@rokonec, I resolved your first and third comments but left your second one because you fixed that in your PR. As I said there, we can merge one of the PRs and resolve conflicts then, or I can pull your changes into my branch, and we can merge them as one change. I'm ok with either way.

@Forgind Forgind added the merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now. label Sep 12, 2023
@rainersigwald rainersigwald merged commit caf06d1 into dotnet:main Sep 12, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inspect ConsoleMode before sending control codes on Windows
5 participants