CSharpShellApp icon indicating copy to clipboard operation
CSharpShellApp copied to clipboard

Porting the app to .NET 7

Open radimitrov opened this issue 3 years ago • 19 comments

Next week I will start porting the app to .NET 7 from the current Xamarin.Android project. There are a few changes that will happen. This process will take at least a few weeks. Here is a list of the changes that will happen.

  1. The app will support newer libraries due to the .NET 7 BCL. Also some performance boosts from that.
  2. Xamarin.Forms will be replaced with .NET MAUI. I will implement a basic migrator.
  3. ASP.NET Core 2.2 will be removed but ASP.NET Core 7.0 won't be included. Keeping the 2.2 version isn't possible. I can't figure out how to get it running under Android. Might actually not be possible since Microsoft don't intend to support that. So at least for now the app will continue without it. I've attached a basic project that simulates the issue in case anyone has any ideas. AndroidSimulatedWebApplication.zip

radimitrov avatar Nov 09 '22 20:11 radimitrov

That's really great, have been waiting for this for quite a while. By the way, is there any possibility you would add support for global usings? For now, adding global usings results in an error CS8915

1ffycat avatar Nov 10 '22 13:11 1ffycat

I understand the need for progress and this is a great step forward but can Xamarin.Forms co-exist alongside MAUI and be included for backwards compatibility?

Great app and quite impressed with Xamarin Forms now its going to be replaced :)

firstygoldfish avatar Nov 10 '22 15:11 firstygoldfish

@1ffycat That's an app bug. I can probably fix it tomorrow.

@firstygoldfish MAUI.NET is practically the next Xamarin.Forms with changed namespaces and a few improvements. Despite that, I don't think Xamarin.Forms will work under an .NET 6 Android app. Even if it does I expect major conflicts if both are added to the project.

radimitrov avatar Nov 10 '22 16:11 radimitrov

I understand its the replacement but it would be nice to be able to support both. It would be easier if I could have the old version and new version installed at the same time. Thanks again for the speedy response. All good feedback.

firstygoldfish avatar Nov 11 '22 00:11 firstygoldfish

@firstygoldfish Yes, I do intend to copy and modify the last build as an archive package and upload it in the Google Drive folder with a different package name.

radimitrov avatar Nov 11 '22 11:11 radimitrov

Yes thats nice to see. By the way, about the reference assembly that are being referred by default example. System.Runtime. is there a way to remove it? coz it conflicts with the nuget package im including in the project, thus it wont export the assembly because of that error.

jgranserver avatar Nov 11 '22 12:11 jgranserver

No. System.Runtime isn't explicitly referenced by default. It is a dependency. However if you could that wouldn't matter. Even if you reference another System.Runtime package the Mono runtime will still use the one already inside the app.

radimitrov avatar Nov 11 '22 13:11 radimitrov

[Error] CS1705: Assembly 'TShockAPI' with identity 'TShockAPI, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' which has a higher version than referenced assembly 'System.Runtime' with identity 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

they have the same public token but it will still have this kind of error.

jgranserver avatar Nov 11 '22 13:11 jgranserver

@jgranserver This package? It only supports .NET 6.0.

radimitrov avatar Nov 11 '22 13:11 radimitrov

oh okay. will this be supported when the app ported to .NET 6?

jgranserver avatar Nov 11 '22 14:11 jgranserver

@jgranserver Yes, it should be.

radimitrov avatar Nov 11 '22 14:11 radimitrov

does the update now supports .NET6?

jgranserver avatar Nov 19 '22 10:11 jgranserver

@jgranserver No. I've just started porting it. It will take a while. Last update was just a hotfix. The .NET update will be app version 3.0. And it should say something like ".NET 7" in the main menu, if I remember correctly

radimitrov avatar Nov 19 '22 15:11 radimitrov

Please add some demo/examples on working with xml/xaml file in Xamarin.Android project, it frustrating to make layouts programmatically

BanDroid avatar Dec 02 '22 07:12 BanDroid

@BanDroid Doesn't have much to do with .NET versions, except how it will always work under Android. The app may always be limited in regards to Android resources and C# <-> Java. Best I could do for now is add this (haven't tested it yet).

radimitrov avatar Dec 06 '22 17:12 radimitrov

@BanDroid Doesn't have much to do with .NET versions, except how it will always work under Android. The app may always be limited in regards to Android resources and C# <-> Java. Best I could do for now is add this (haven't tested it yet).

I know 😅 i commented here just so you know. Inflating layout at runtime is good too, but the view could be from material design, is it possible?

BanDroid avatar Dec 06 '22 18:12 BanDroid

It should be.

radimitrov avatar Dec 06 '22 21:12 radimitrov

Well, this took longer than expected (porting bug), but I'm nearly done. Aside from a few minor things all that is left is some of the MAUI support. Might be ready January but the first week of February is more likely. A short list of changes:

  • .NET 7 libraries
  • Replacing Xamarin.Forms with .NET MAUI. Most Xamarin.Forms code should still work. Mostly different namespaces. I've implemented some basic code porting to help with that.
  • Removal of ASP.NET 2.2 (will be uploading an archive APK with support)
  • Replaced the WebView editor with a faster native one. I will adding editable themes support after initial release. The only downside is that for now the new editor doesn't implement code folding.

radimitrov avatar Jan 18 '23 19:01 radimitrov

At least a week later than expected, however it is now ready. The update has been released and should be available soon.

Currently there are just 4 editor themes and they seem to basically be 90% operational in regards to syntax highlighting for now. Today I'm updating the Google Play build, the Huawei and custom ones will come next week

Good news, an old feature is back in the Google Play version of the app - exporting APK. Still no one-click install since Google policies forbid it in such a context, however that is what file manager apps are for.

Now the bad news. It appears Visual Studio has more issues with desugaring. I will have to investegate a bit. However this means that for now the update is for devices with Android >= 7.0.

radimitrov avatar Feb 12 '23 17:02 radimitrov