.NET 6 中的同步属性?

SynchronizationAttribute in .NET 6?

我最近将一个 .NET Framework 4.0 应用程序迁移到了 .NET Core,除了多线程问题,我已经完成了 99%。 .NET Core 似乎不再支持 [Synchronization] 属性,或者我忽略了什么。

我有一个 class,我过去用它来处理线程,效果很好。
现在我看到波浪线表明我可能缺少参考?

我正在使用 .NET 6。

[Synchronization]
public class threaded
{...}

有两种 SynchronizationAttribute 类型,都仅在 .NET Framework 中可用。

  • .NET Framework technologies unavailable on .NET Core and .NET 5+, see Remoting.

    .NET Remoting isn't supported on .NET 5+ (and .NET Core). .NET remoting was identified as a problematic architecture. It's used for communicating across application domains, which are no longer supported. Also, remoting requires runtime support, which is expensive to maintain.

  • Overview of porting from .NET Framework to .NET, see Unavailable technologies.

    Remoting is used for communicating across application domains, which are no longer supported.

  • System.Runtime.Remoting.Contexts.SynchronizationAttribute 文档,参见 Applies to

  • System.EnterpriseServices.SynchronizationAttribute 文档,参见 Applies to

  • Synchronizing data for multithreading.

    Synchronized contexts. For .NET Framework and Xamarin applications only, you can use the xref:System.Runtime.Remoting.Contexts.SynchronizationAttribute to enable simple, automatic synchronization for xref:System.ContextBoundObject objects.