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

Large number of problems trying to convert large VB project in large solution to c# #1045

Open
ibelchamber opened this issue Nov 22, 2023 · 7 comments
Labels
needs-repro Needs either the input that caused the error, or more information to allow reproducing the error VB -> C# Specific to VB -> C# conversion

Comments

@ibelchamber
Copy link

We have a solution with 33 projects, It is currently in UWP + Xaml Islands, as this seems to be not the way forwards now I would like to try to migrate to WinUi3 which does not support VB, so my first step is to convert vb to c#.

First attempt on the first VB project looked quite good, only about 33 errors. Most of these were things going wrong converting subs / functions that had Optional byref parameters. I removed byref in the original VB (was not needed) then A load more came up. Fixed those and retried, then I was up to 364 errors, mostly it seems:

enums have been converted to ints
colours are not correctly converted: CS1503 Argument 2: cannot convert from 'Windows.UI.Color' to 'Global.Windows.UI.Color?'
there are probably 20 different error types.

It would take days to try to sort this out, but my concern would be that after that, the number of problems will just increase again.

What is the best approach to try to progress this? Would anyone be interested in taking a copy of our solution and investigating the faults? It does seem to be exposing a vast number of issues that maybe obstruct smaller conversions but maybe not as badly,

Thanks.

@ibelchamber ibelchamber added the VB -> C# Specific to VB -> C# conversion label Nov 22, 2023
@GrahamTheCoder
Copy link
Member

GrahamTheCoder commented Nov 23, 2023

Thanks for getting in touch. I'd agree that a conversion of that size is likely to take more than a few days to get compiling in c#.

The approach I'd suggest is to initially go one project at a time from the bottom of the dependency tree to keep the errors manageable.
First just spike it, E. G. Regex or comment out problematic bits until it compiles just to see the scale of issues. There are some other hints on general approach on the wiki. But basically, commit often.

For each type of issue, we will need to get a minimal repro for a unit test so we can fix it.

If you can share the git repo or zipped version of the solution causing issues it will definitely be useful. Though to be clear, I'm not intending to deliver a converted repo back, or even promising to make the converter all work perfectly for it. I also can't guarantee when I'll have time to work on improving conversion for the types of errors found - December is very busy for me.

@ibelchamber
Copy link
Author

Many thanks for your response. we will investigate further and may have more feedback / questions. We are also trying to evaluate how confident we are with winui3, the concern is that we could put man years of effort into porting to that and then have to do it all again. It is a nightmare trying to develop very large applications with long lifetime with Microsoft keeping on changing things.

@GrahamTheCoder
Copy link
Member

GrahamTheCoder commented Nov 24, 2023

Sorry, yes since your focus is UI you should probably start at the top of the tree with ui projects. Be aware that integration points with the many ui frameworks is a weak point of the converter. But usually the issues are simple but widespread.

Converting to c# is likely to set you up well for the future in any case, but obviously does have risk and time cost.

Please do open an issue for any individual errors you find, or send the whole solution (just email directly if you don't want to share it publicly)

@GrahamTheCoder GrahamTheCoder added the needs-repro Needs either the input that caused the error, or more information to allow reproducing the error label Dec 10, 2023
@GrahamTheCoder
Copy link
Member

Reopen if you can share any details of particular issues

@GrahamTheCoder GrahamTheCoder closed this as not planned Won't fix, can't repro, duplicate, stale Dec 10, 2023
@ibelchamber
Copy link
Author

Hi apologies too much going on, I would really appreciate you having a look at the solution but do not want to provide it publicly, I have a googledrive link of the zip, can I send it to you privately?

@GrahamTheCoder
Copy link
Member

GrahamTheCoder commented Dec 12, 2023

Yes, that's fine so long as you're happy with me using it for the purposes of manual testing and won't hold me liable for any damages caused if it is leaked somehow if future. I'll take reasonable steps to protect it as I would my own data. If you're happy with that, let me know and send a link to grahamthecoder@gmail.com.

Additionally, let me know whether you would you be ok with me deriving automated tests from small subsections of code.
I can change variable/method names if you like for example, but if you have some absolutely crucial secret algorithm(s), you should say no (or omit those key parts).

@ibelchamber
Copy link
Author

Hi Graham,

Many thanks this is most helpful, I will email you directly,

Ian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-repro Needs either the input that caused the error, or more information to allow reproducing the error VB -> C# Specific to VB -> C# conversion
Projects
None yet
Development

No branches or pull requests

2 participants