C#: Fix crash on machines/VMs with 1 hardware thread (#134)

This commit is contained in:
Katy Coe
2021-02-04 12:58:24 +01:00
parent 9aada15c00
commit 297b3016f8

View File

@@ -205,7 +205,7 @@ namespace Il2CppInspector.Outputs
var results = new ConcurrentBag<Dictionary<TypeInfo, StringBuilder>>(); var results = new ConcurrentBag<Dictionary<TypeInfo, StringBuilder>>();
// Generate each type // Generate each type
Parallel.ForEach(types, new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount / 2 }, Parallel.ForEach(types, new ParallelOptions { MaxDegreeOfParallelism = Math.Max(Environment.ProcessorCount / 2, 1) },
() => new Dictionary<TypeInfo, StringBuilder>(), () => new Dictionary<TypeInfo, StringBuilder>(),
(type, _, dict) => { (type, _, dict) => {
// Skip namespace and any children if requested // Skip namespace and any children if requested