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

Bad State Exception #388

Open
workgroupengineering opened this issue May 5, 2021 · 4 comments
Open

Bad State Exception #388

workgroupengineering opened this issue May 5, 2021 · 4 comments

Comments

@workgroupengineering
Copy link

Describe the bug

When using Build Logging in a solution that contains a project in SDK-Style format. If you open log, the Bad State exception is displayed.

How Reproduce

  1. Create new solution with Console Project target .net Core 3.1 or upper
  2. Start Build Logging
  3. Build the solution
  4. Stop Build Logging
  5. Try to open log

Workaround

nothing

Diagnosis

Of the diagnosis I made the exception depends on the following lines:

CheckProjectEventContext(args);
if (args.ParentProjectBuildEventContext.TargetId != -1 ||
args.ParentProjectBuildEventContext.TaskId != -1 ||
args.ParentProjectBuildEventContext.EvaluationId != -1)
{
throw new LoggerException(Resources.BadState);
}

CheckProjectEventContext(args);

There is something wrong with the conditions. If comment the log is displayed.

I would like to create a PR to correct the conditions, but not knowing the precise meaning, I would not want to introduce other problems.

Environment

Visual Studio: Microsoft Visual Studio Community 2019 Build 16.9.4+31205.134
Project System Tools: 1.0.1.2010501

Screenshot

immagine

immagine

@rvuistin
Copy link

I have the same issue

@workgroupengineering
Copy link
Author

workgroupengineering commented May 27, 2021

I tried with Visual Studio 16.16.0, the problem persists. I think it may depend on #389

@KyleKolander
Copy link

I have the same issue. Visual Studio Enterprise 2019 Version 16.10.4.

@drewnoakes
Copy link
Member

This only seems to apply to VS2019. I cannot reproduce is in VS2022.

Can someone who hits this please confirm whether they are opening the logs internally or externally?

If it's the internal viewer that's hitting this, the workaround may be to use the external viewer (which has more features anyway): https://msbuildlog.com/

@KirillOsenkov KirillOsenkov removed their assignment Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants