-
Notifications
You must be signed in to change notification settings - Fork 219
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
Handle C# ref return
when converting VB->C#
#1116
Handle C# ref return
when converting VB->C#
#1116
Conversation
It can never be converted because of the ref return properties
@GrahamTheCoder to make the tests work, we'd need to either upgrade Roslyn to at least 4.8, or comment the with-block tests out. |
There's now a prerelease that seems to generally work, so I've pushed that. |
Just spotted the project level tests are having an issue too with the new version of roslyn. I'll have to come back to this and the other issue another day now I'm afraid. Ideas/fixes welcome. Would be good to upgrade to latest if possible. |
My findings so far:
The path it's looking at is To me this looks like a Roslyn issue, but I have no idea what's going on there. |
I think the problem is in the combination of Xunit and some change in Roslyn. Also, a similar setup using MSTest works fine. |
OK yeah looks like we're stuck. Let's merge this fix with the tests marked as skipped and a comment linking to this issue or directly to the upstream bugs if/when logged upstream. |
I'm not even sure whose issue this one is: Xunit or Roslyn :) |
Btw, I tried following workaround: private void CopyBuildHost()
{
Assembly[] loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
Assembly msBuildAssembly = Array.Find(loadedAssemblies, assembly => assembly.FullName.Contains("Microsoft.CodeAnalysis.Workspaces.MSBuild"));
var BuildHostDirName = "BuildHost-net472";
if (!Directory.Exists($"./{BuildHostDirName}")) return;
var targetFolder = Path.Combine(Path.GetDirectoryName(msBuildAssembly.Location), BuildHostDirName);
Directory.CreateDirectory(targetFolder);
foreach (string file in Directory.GetFiles(BuildHostDirName))
{
string fileName = Path.GetFileName(file);
string destinationPath = Path.Combine(targetFolder, fileName);
File.Copy(file, destinationPath, false);
}
} which got me |
I was getting |
ebcb7e3
to
4a85f8b
Compare
Problem
ref return
from a C# lib is involvedvar withBlock = lst[i];
should beref var withBlock = ref lst[i];
ifref return
from a C# lib is involvedSolution
prop.ReturnsByRef || prop.ReturnsByRefReadonly
in a few places.I had to ignore a project in
ConvertWholeSolutionAsync
(C#->VB) because of theref return
.MultiFileSolutionAndProjectTests
tests will fail because of System.InvalidOperationException: Unexpected value 'PropertyAccess' of type 'Microsoft.CodeAnalysis.VisualBasic.BoundKind' dotnet/roslyn#68194This is fixed in Roslyn 4.8, but I haven't touched the references.