簡體   English   中英

NotImplementedException:方法或操作未實現。 在 C# 中調用 GC.TryStartNoGCRegion() 時

[英]NotImplementedException: The method or operation is not implemented. when calling GC.TryStartNoGCRegion() in C#

我試圖阻止 .NET 垃圾收集器收集一段時間。 我發現我可以使用GC.TryStartNoGCRegion()方法來做到這一點。 但是,這會引發此異常:

未處理的異常:System.NotImplementedException:方法或操作未實現。 在 System.GC.StartNoGCRegionWorker (System.Int64 totalSize, System.Boolean hasLohSize, System.Int64 lohSize, System.Boolean disallowFullBlockingGC) [0x00000] in <1400ea11d6fd49d4939be686a9549fb4>:0 在 System.GC.TryStartNoGCRegion (System.Int64 totalSize, System. Boolean disallowFullBlockingGC) [0x00000] in <1400ea11d6fd49d4939be686a9549fb4>:0 ...

我執行了這行代碼:

GC.TryStartNoGCRegion(4096, true)

.NET 版本 4.7.2

原來我實際上是在 Mono 上。 Mono 在運行GC.TryStartNoGCRegion()時會拋出這個確切的錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM