我创建了一个应用程序,它使用此包中的 Windows-API-Code-Pack 从文件中读取属性。我在检索属性时遇到问题
var width = fileInfo.Properties.GetProperty(SystemProperties.System.Video.FrameWidth).ValueAsObject;
代码在这里中断给我
System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellPropertyFactory.GenericCreateShellProperty[T](PropertyKey propKey, T thirdArg)
at Microsoft.WindowsAPICodePack.Shell.PropertySystem.ShellProperties.GetProperty(PropertyKey key)
这主要发生在 PLINQ 中调用这部分代码时
.AsParallel().WithDegreeOfParallelism(_maxConcurrentThreads).ForAll(...)
即使度数设置为1。我该如何解决?