theraot / Theraot

Backporting .NET and more: LINQ expressions in .net 2.0 - nuget Theraot.Core available.
MIT License
162 stars 30 forks source link

[Question] Is there any plan to release Theraot 4.0.0 nuget? #194

Open workgroupengineering opened 2 years ago

NN--- commented 2 years ago

Just curious what is the reason you need this library today ?

workgroupengineering commented 2 years ago

I have old software that uses proprietary libraries to communicate with a device. The manufacturer no longer exists and it is not possible to have the updated library that supports .net 4.0 and higher.

NN--- commented 2 years ago

You can run almost any .NET 3.5 program over CLR 4.0 using application manifest. It probably worth trying. I have been using this for years because starting Windows 8 there is only .NET 4.0 and above installed by default.

What about option to decompile and compile with a newer framework ? If manufacturer doesn't exist anymore, probably, this would be allowed.

workgroupengineering commented 2 years ago

You can run almost any .NET 3.5 program over CLR 4.0 using application manifest. It probably worth trying. I have been using this for years because starting Windows 8 there is only .NET 4.0 and above installed by default.

I did not know this possibility. Can you give more documentation about it?

What about option to decompile and compile with a newer framework ? If manufacturer doesn't exist anymore, probably, this would be allowed.

Unfortunately I'm alone, the library is large, obfuscated and mixes native and managed code.

It would take years to convert.

NN--- commented 2 years ago

Sure

https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-configure-an-app-to-support-net-framework-4-or-4-5

Myapp.exe.config


<configuration>
  <startup>
    <supportedRuntime version="v4.0"/>
 If you want you can also have a falllback to 3.5 in case 4.0+ is not present 
<supportedRuntime version="v2.0.50727"/>

  </startup>
</configuration>
OwnageIsMagic commented 2 years ago

@NN---

Just curious what is the reason you need this library today ?

We have around 800-1000 XP devices left per client (10 clients around the world). Most of them are gen1/2 Intel meaning it need full replacement (cpu + mobo + ide->sata hdd + vga->dvi say 250$) to upgrade to new Windows version. Each device is connected to peripheral hardware of the same era with proprietary kernel driver (not supported by vendor anymore, so no builds for recent Windows), 300$ per unit compatible with win10. 900 10 550$ == 5kk$ + deployment costs or they could just pay me x1.5 rate and I would continue support XP for next 5-10 years.

NN--- commented 1 year ago

@OwnageIsMagic What is the compiler are you using ? Can you use the latest C# compiler from .NET 8 SDK targeting .NET 4.0 for example ?

OwnageIsMagic commented 1 year ago

Yes, I actually use NET8 RC SDK for dev builds and latest stable in CI. But it doesn't matter since once compiled to IL and packed it's indistinguishable from code compiled with the old native csc (modulo bugs and edge cases). You mentioned PolySharp earlier so I'll assume you investigating usage of Roslyn source generators. This is definitely not going to work in our case. PolySharp explicitly ships only types required for language features and all of them (except Index and Range) are just attributes in S.R.CompilerServices namespace. They are well-known for compiler and it binds to them by name ignoring type identity. In our case we are shipping implementations and type identity is very important (you will get 'System.TypeA' is not castable to 'System.TypeA' error in runtime otherwise). There is also other major issues like code bloat/compile slowdown (esp for net20 full LINQ and TPL), non default SDK (issues with WPF temp projects) or ASP.NET even targeting net48 not compatible with new SDK format (see https://github.com/SimonCropp/Polyfill/issues/101).


What can we actually do with source generators is automatic placement of #if-#else on build (on our side) based on corresponding tfm ref assemblies or docs (whichever would be easier to parse).