我有点没有想法。使用以下代码,我尝试实例化一个大于 2GB 的字节数组:
var b = Array.CreateInstance(typeof(byte), uint.MaxValue);
每次它都会导致一个System.ArgumentOutOfRangeException
异常的消息arrays larger then 2GB are not supported
。
我的 App.config 目前如下:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
<runtime>
<gcAllowVeryLargeObjects enabled="true" />
</runtime>
</configuration>
此外,该项目的目标平台是x64
我会很感激任何想法。如果缺少任何信息,我会尽快更新问题。
更新 1
我也试过uint.MaxValue