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

Crashes Visual Studio When Opening docker-compose.yml #190

Open
dlumpp opened this issue Apr 1, 2021 · 8 comments
Open

Crashes Visual Studio When Opening docker-compose.yml #190

dlumpp opened this issue Apr 1, 2021 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@dlumpp
Copy link

dlumpp commented Apr 1, 2021

When I click docker-compose.yml in Solution Explorer to open an editor, Visual Studio immediately locks up and becomes unresponsive, requiring a task kill.

I only discovered it was this extension when I happened to notice a message from you in my output window that said something like "unexpected file type DockerCompose."

I'm happy to provide logs to help you troubleshoot if you tell me how to gather them.

@christianhelle
Copy link
Owner

christianhelle commented Apr 1, 2021

Oh wow... I never tried or heard of this before but this definitely sounds bad!

Thanks for letting me know!

I'll investigate immediately what could be wrong. I know that if you add a custom tool to a json/yml/yaml file on the project then the custom tool will run some code in my extension. Since the custom tool needs to be explicitly set, either manually, or by using the "Add New REST API Client" context menu, I have some assumptions that the json/yml/yaml file is an Open API specifications document and I parse accordingly. I handle errors here by writing to the output window and if the error is unexpected or critical I show a message prompt

@christianhelle christianhelle self-assigned this Apr 1, 2021
@christianhelle christianhelle added the bug Something isn't working label Apr 1, 2021
@christianhelle
Copy link
Owner

christianhelle commented Apr 1, 2021

I'm happy to provide logs to help you troubleshoot if you tell me how to gather them.

@dlumpp That would be great to have for troubleshooting.

I log everything out to the Output Window. So just copy/pasting from that would be enough

Thanks in advance

@dlumpp
Copy link
Author

dlumpp commented Apr 1, 2021

Sorry I tried a few times but I can't get that log output to show up again before VS becomes unresponsive. I must have gotten lucky the one time I noticed it!

@christianhelle
Copy link
Owner

Thank you very much for trying @dlumpp

I also tried as well from my end but I can't seem to reproduce it

If you don't mind I just have a few more questions...

  • Is this yaml file include in a C# project or is it purely a solution item under a certain solution folder?

  • If the yaml file is included in a C# project, does it have a custom tool set on it? You can check this in the properties window of Visual Studio, or by looking directly in the csproj file and checking if the yaml file has an associated <Generator>

Something like this:

  <ItemGroup>
    <None Update="docker-compose.yml">
      <Generator>AutoRestCodeGenerator</Generator>
    </None>
  </ItemGroup>

If its not included in a C# project and there is no custom tool or <Generator> associated with it then I'm a bit at a loss. But I will keep this issue open until I can fully figure out what could be wrong

When I write to the Output Window, I use the my own category called REST API Client Code Generator. All trace information is written directly to this

@christianhelle
Copy link
Owner

Oh and one last thing @dlumpp

Do you mind sharing the support key of your installation. You can find it under Tools -> Options -> REST API Client Code Generator -> Analytics

Screenshot 2021-04-01 22 06 37

Thanks in advance

@dlumpp
Copy link
Author

dlumpp commented Apr 1, 2021

My support key is b463d8b. Thanks for putting so much effort into looking into this.

There is some special tooling around docker compose files. It's built into Visual Studio. When it's working you get a docker-compose node with the little docker whale icon under your solution and you can pick "Docker Compose" as your start up project. I think VS does this via a pseudo-project entry in the sln file.

I went looking for a sample project for you. Open up the src/sln file in https://github.com/dotnet-architecture/eShopOnContainers/ and you'll see what I mean. Interestingly enough, this solution does not crash my VS, however I do see your extension outputting Unexpected output type found - DockerCompose repeatedly in the output window. Perhaps my own file has something more complex than this one that's causing problems.

@christianhelle
Copy link
Owner

I couldn't see any analytics or error data from your support key, even after waiting a day. My tool is designed to lazy load upon use and "use" in this case is defined by generating code via any of my custom tool (single file generators) or using any of the solution explorer context menu extensions

All that said, I think this issue is very interesting as I have no idea what's wrong. Thank you very much for reporting this @dlumpp. I take pride in my work and helping others, and I hope that I can figure out what's going on here

If you don't mind sharing your Docker Compose file then it might help me a bit. You can post it in this issue or you can send it to christian [dot] helle [at] outlook [dot] com. But please trim out the secrets or at least replace them with bogus incorrect values first :)

@christianhelle
Copy link
Owner

Status Update:

I started investigating the solution you provided @dlumpp (thanks again for that)

I can see that my TraceListener implementation that writes to the Visual Studio Output Window is getting calls from Visual Studio itself, or other Visual Studio extensions. The thing is, when you build Visual Studio extensions, you're extension is running in the Visual Studio context meaning that if Visual Studio itself, or other extensions, use Trace.WriteLine(string) then my TraceListener captures these messages and writes it to my custom Output Window category. The same goes for capturing unhandled exceptions, my extension captures all sorts of exceptions that have nothing to do with my code. Unfortunately, this doesn't really explain why Visual Studio hangs completely.

I'll dig deeper into this and find a fix or at least come up with a work around

@christianhelle christianhelle added the in progress Work is in progress label Apr 20, 2021
@christianhelle christianhelle removed the in progress Work is in progress label May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants