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

Project conversion converts proj file then pauses for a long time with no feedback #132

Closed
TimPurdum opened this issue Jun 7, 2018 · 6 comments
Assignees
Labels
C# -> VB Specific to C# -> VB conversion VB -> C# Specific to VB -> C# conversion

Comments

@TimPurdum
Copy link

Erroneous output

Right-click on VB project, select Convert to C# converts just .vbproj file to .csproj

Expected output

Right-click on VB project, select Convert to C# converts all project files.

Details

Product in use: VS 2017 Extension

Version in use: 5.7.0.0

There is very little documentation, so I may be missing something obvious here. I know older versions were capable of converting a project. Currently, I seem to be limited to doing each file individually.

@GrahamTheCoder
Copy link
Member

GrahamTheCoder commented Jun 8, 2018

Thanks for the report. I've added this wiki page as a very quick first pass at documenting the usage. I won't do much more until I get feedback on its usefulness.

To summarize for your particular case - your intuition is correct. i.e. When you convert a vbproj it will:

  • Create a converted .csproj alongside it
  • Create a converted .cs file for each .vb file within that project
  • Ask whether to update the solution file and any referencing projects.

The only exceptions to this that come to mind are:

  • Any files outside the solution folder aren't converted - currently the tool doesn't warn about these ignored files - I'll add something into the output.
    • Specifically it does this which also has potential for failure if the paths aren't normalized the same way by Roslyn somehow.
  • Any files containing vb but with other extensions aren't converted. e.g. aspx, vbhtml. This is mentioned in Known limitations #16

I've just manually verified this works as described on two test projects using the 5.7.0.0 extension.

  • To troubleshoot this case further it'd be useful to see the contents of the Code Converter output window (click cancel when asked whether to update the solution file and any referencing projects, otherwise it gets cleared...or use the master where that's fixed).
  • Contents of the vbproj (if it's an open source project then just link to the repo and I'll try it out myself).

@TimPurdum
Copy link
Author

Thanks for your response. I get no dialog when clicking Convert to C#, it goes straight to the output window with just this:

`--------------------------------------------------------------------------------
Writing converted files to disk:

  • filepath\projectName.csproj------------------------------------`

The created csproj looks good, but the .cs files are not created. I unfortunately can't share the whole project file, but below is some of the opening.

<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid></ProjectGuid>
    <OutputType>Library</OutputType>
    <MyType>Windows</MyType>
    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
    <SccProjectName>
    </SccProjectName>
    <SccLocalPath>
    </SccLocalPath>
    <SccAuxPath>
    </SccAuxPath>
    <SccProvider>
    </SccProvider>
    <TargetFrameworkProfile />
  </PropertyGroup>

@GrahamTheCoder
Copy link
Member

GrahamTheCoder commented Jun 17, 2018

Interesting. Since there's no error, the most likely cause is that:

  • It's detecting no syntax trees - this could happen if there was an issue with the project file or it used something like MSBuild variables in the file names
  • The project files do not start with the solution directory

To narrow the possible causes, could you create a brand new library vbproj + solution and see if it converts that ok (to just an empty class or whatever)?

  • If it does, could you try copy-pasting your files into that project folder, clicking "show all files" in the solution explorer, selecting/including them all, then try converting the project again (the references won't be right, but it should at least have a slightly ill-fated attempt at the conversion).
    • If that generates some .cs files with any success, have a look at how the project file differs from your own (other than the references), and see if you can isolate the thing which causes the problem (it may also be relevant to look at any projects you've previously converted successfully and whether they can still be converted by this version).
  • Otherwise, it'd be helpful to know which Visual Studio version you're using, and if you recall which extension version last worked for you (roughly speaking).

@GrahamTheCoder GrahamTheCoder added the VB -> C# Specific to VB -> C# conversion label Jun 17, 2018
@GrahamTheCoder
Copy link
Member

GrahamTheCoder commented Jun 25, 2018

There's a chance this was a symptom that will be fixed by #135 (now released)
If so, it'd probably mean some conversion error messages are getting swallowed somewhere.

@PaulVrugt
Copy link

I had the same issue, it turned out I was simply too impatient. After waiting for a long time it started converting the files too. Might be a good idea to let the user know something is happening in the background after converting the project file

@GrahamTheCoder
Copy link
Member

Thanks for getting in touch, it all makes sense now. It compiles any other referenced projects of the same language, and gives no feedback about doing so. If the project being converted references lots of other projects (or large projects, or running on a slow machine, etc.), it could take a long time with no feedback.

Should be an easy fix, I'll try to get it done soon. I think there's also some caching I might be able to do to slightly speed up that time - I'll look into that afterwards.

@GrahamTheCoder GrahamTheCoder changed the title VB -> C# project conversion only converts .vbproj file Project conversion converts proj file then pauses for a long time with no feedback Aug 17, 2018
@GrahamTheCoder GrahamTheCoder added the C# -> VB Specific to C# -> VB conversion label Aug 17, 2018
@GrahamTheCoder GrahamTheCoder self-assigned this Aug 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C# -> VB Specific to C# -> VB conversion VB -> C# Specific to VB -> C# conversion
Projects
None yet
Development

No branches or pull requests

3 participants