-1

I have an old .NET 4.8 Windows service that I am upgrading to .NET 9 and C#.

The application uses custom garbage collection to manage a high load of disposable objects. To do this it uses the LifetimeServices class in System.Runtime.Remoting.Lifetime.

Does anyone know if there is a replacement in .NET 9 ? Unfortunately, standard garbage collection is not applicable.

Edit: this is not a web application; I'm hoping that net 9 has an equivalent built in and I don't need handle object leases. The standard garbage collector cleanup period is too long.

5
  • 3
    If you haven't already, I recommend you read this: learn.microsoft.com/en-us/dotnet/core/compatibility/… In short: there is no replacement, and you'll have to move to a different architecture style. Commented Aug 19 at 23:20
  • 1
    There is no such thing as "custom garbage collector" in .NET Framework. Commented Aug 20 at 0:18
  • 2
    Given how much the GC has evolved since Framework, the assumption that you still need to do some "custom garbage collection" (whatever that means) needs a lot of justification. Commented Aug 20 at 6:08
  • 3
    Having a "high load of disposable objects" and "standard garbage collection is not applicable" raises a few red flags. What kind of resource does these objects own? How is the lifetime determined? I'm guessing you are managing the lifetime of your objects somehow, but that is not really "garbage collection", at least not the way GC is defined in .Net. Commented Aug 20 at 9:38
  • I'm ok with there not being a replacement, I am trying to find out how to achieve the same thing. Commented Aug 21 at 1:12

1 Answer 1

4

.NET Core does not support Framework-style remoting, there is no equivalent. You need to use an alternative RPC implementation. There are many available, depending on platform(s). Google's gRPC is a popular choice: it is mature and well-supported across a wide range of platforms and languages. It is one of the RPC core technologies in the Google Cloud, so you can rely on it not going away.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.