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

Refactoring: Moving type to file fails #1098

Closed
elohmeier opened this issue Dec 28, 2016 · 2 comments
Closed

Refactoring: Moving type to file fails #1098

elohmeier opened this issue Dec 28, 2016 · 2 comments

Comments

@elohmeier
Copy link

Environment data

dotnet --info output:
.NET Command Line Tools (1.0.0-preview4-004233)

Product Information:
Version: 1.0.0-preview4-004233
Commit SHA-1 hash: 8cec61c6f7

Runtime Environment:
OS Name: Mac OS X
OS Version: 10.12
OS Platform: Darwin
RID: osx.10.11-x64
Base Path: /usr/local/share/dotnet/sdk/1.0.0-preview4-004233
VS Code version: 1.8.1
C# Extension version: 1.6.2

Steps to reproduce

  1. Create a file containing multiple classes in a single namespace.
  2. Move the cursor to the class name of the class to move
  3. Press Command+.
  4. Click on "Move type to classname.cs"

Expected behavior

  • A new file is created containing the extracted class definition
  • The class is removed from the original file

Actual behavior

Omnisharp won't do the refactoring and crashes, this is the output:

Starting OmniSharp server at 12/28/2016, 11:16:23 PM
Target: /Users/enno/Development/price-service/PriceService.sln

OmniSharp server started wth Mono
Path: /Users/enno/.vscode/extensions/ms-vscode.csharp-1.6.2/bin/run
PID: 51542

OmniSharp: -s /Users/enno/Development/price-service/PriceService.sln --hostPID 51500 --stdio DotNet:enablePackageRestore=false --encoding utf-8 formattingOptions:useTabs=false formattingOptions:tabSize=4 formattingOptions:indentationSize=4
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Startup","Message":"Omnisharp server running using Stdio at location '/Users/enno/Development/price-service' on host 51500."},"Seq":1,"Type":"event"}
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Initializing in /Users/enno/Development/price-service
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Auto package restore: False
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Update workspace context
[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Resolving projects references
[INFORMATION:OmniSharp#MSBuild] MSBUILD_EXE_PATH environment variable set to /Users/enno/.vscode/extensions/ms-vscode.csharp-1.6.2/bin/omnisharp/msbuild/MSBuild.dll
[INFORMATION:OmniSharp#MSBuild] MSBuildExtensionsPath environment variable set to /Users/enno/.vscode/extensions/ms-vscode.csharp-1.6.2/bin/omnisharp/msbuild
[INFORMATION:OmniSharp#MSBuild] MSBuildSDKsPath environment variable set to /Users/enno/.vscode/extensions/ms-vscode.csharp-1.6.2/bin/omnisharp/msbuild/Sdks
[INFORMATION:OmniSharp#MSBuild] Detecting projects in '/Users/enno/Development/price-service/PriceService.sln'.
[WARNING:OmniSharp#MSBuild] Skipped unsupported project type 'src'
[INFORMATION:OmniSharp#MSBuild] Loading project from '/Users/enno/Development/price-service/src/PriceService/PriceService.csproj'.
[WARNING:OmniSharp#ProjectFileInfo] Couldn't locate Mono, TargetFrameworkRootPath not specified
[INFORMATION:OmniSharp#MSBuild] Add project: /Users/enno/Development/price-service/src/PriceService/PriceService.csproj
[WARNING:OmniSharp#MSBuild] Skipped unsupported project type 'Solution Items'
[INFORMATION:OmniSharp#MSBuild] Update project: PriceService
[INFORMATION:OmniSharp.Script.ScriptProjectSystem] Detecting CSX files in '/Users/enno/Development/price-service'.
[INFORMATION:OmniSharp.Script.ScriptProjectSystem] Could not find any CSX files
[INFORMATION:OmniSharp.Startup] Configuration finished.
[INFORMATION:OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.RunCodeActionService] Applying Microsoft.CodeAnalysis.CodeRefactorings.MoveType.AbstractMoveTypeService`5+MoveTypeCodeAction[Microsoft.CodeAnalysis.CSharp.CodeRefactorings.MoveType.CSharpMoveTypeService,Microsoft.CodeAnalysis.CSharp.Syntax.BaseTypeDeclarationSyntax,Microsoft.CodeAnalysis.CSharp.Syntax.NamespaceDeclarationSyntax,Microsoft.CodeAnalysis.CSharp.Syntax.MemberDeclarationSyntax,Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax]
[ERROR:Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware] An unhandled exception has occurred: '' is not part of the workspace.
[INFORMATION:OmniSharp.Middleware.LoggingMiddleware] /v2/runcodeaction: 500 446ms

@hugonijhuis
Copy link

Duplicate of #975

@DustinCampbell
Copy link
Member

Yes, this is a duplicate. Thanks for spotting that @hugonijhuis!

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