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

Show Fixes -> Generate type in new file creates an empty file #2112

Closed
brokenbacon opened this issue Mar 14, 2018 · 6 comments
Closed

Show Fixes -> Generate type in new file creates an empty file #2112

brokenbacon opened this issue Mar 14, 2018 · 6 comments
Assignees
Milestone

Comments

@brokenbacon
Copy link

brokenbacon commented Mar 14, 2018

Environment data

dotnet --info output:

$ dotnet --info
.NET Command Line Tools (2.0.2)

Product Information:
 Version:            2.0.2
 Commit SHA-1 hash:  a04b4bf512

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16299
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.0.2\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

VS Code version:

image

C# Extension version:

1.14.0

Steps to reproduce

  1. Open or Create a C# project.
    dotnet new mvc --auth individual
    
  2. Open any C# file. I used Startup.cs.
  3. Type MyClass abc
  4. Click on Show Fixes, or press Ctrl + .
  5. From the list of options, select Generate type 'MyClass' -> Generate class 'MyClass' in new file
  6. Open the generated file MyClass.cs
  7. The file contains an empty file, instead of a basic template.

image

image

Although the screenshots show I'm using some extensions, I removed all the other extensions from VS Code when I was testing this. Plus I tested on two different machines.

Expected behavior

The generated class or interface file should have namespace and class name defined from templates.

Actual behavior

The generated file has no content.

This is bothering me so much. Any helps will be appreciated!

@brokenbacon
Copy link
Author

When I click on "Generate Class" (in the same text file), it works fine.

@brokenbacon
Copy link
Author

I installed the current version on VS Code Insider, and on previous VS Code versions but I still had the same issue. So it looks like this issue is not coming from VS Code but more of this extension itself.

I installed v1.13.1 (https://github.com/OmniSharp/omnisharp-vscode/releases) and the issue was gone. I can generate a new type in a new file.

The version v1.14.0 appears to have introduced this issue. I did not test with other versions.

I tested with Auto Extension Update disabled. This feature is so important to me and it looks like I will have to stay with v1.13.1 for now.

@brokenbacon
Copy link
Author

For a future note to myself and for anyone trying to reproduce:

To disable auto updating extensions:

screen shot 2018-03-19 at 6 58 33 pm

To install a specific version of Extension:

Click on the "Install from VXIS" from the above screenshot, or

code --install-extension myextension.vsix

@brokenbacon
Copy link
Author

This issue is not fixed in the most updated beta version v1.15.0-beta3

@DustinCampbell
Copy link
Member

Thanks for the added detail @brokenbacon! @rchande, could this have been broken with some of your code action changes in 1.14?

@rchande
Copy link

rchande commented Apr 6, 2018

This should be fixed now.

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

No branches or pull requests

3 participants