You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
System.BadImageFormatException: Field 0400016E is not in the range of a declaring type.
at AsmResolver.ThrowErrorListener.RegisterException(Exception exception)
at AsmResolver.DotNet.Serialized.SerializedFieldDefinition.GetDeclaringType()
at AsmResolver.LazyVariable`1.InitializeValue()
at AsmResolver.DotNet.FieldDefinition.AsmResolver.Collections.IOwnedCollectionElement<AsmResolver.DotNet.TypeDefinition>.get_Owner()
at AsmResolver.Collections.OwnedCollection`2.AssertNotNullAndHasNoOwner(TItem item)
at AsmResolver.Collections.OwnedCollection`2.OnInsertItem(Int32 index, TItem item)
at AsmResolver.DotNet.Serialized.SerializedTypeDefinition.CreateMemberCollection[TMember](MetadataRange range)
at AsmResolver.DotNet.Serialized.SerializedTypeDefinition.GetFields()
at AsmResolver.DotNet.TypeDefinition.get_Fields()
at System.Linq.Parallel.SelectManyQueryOperator`3.SelectManyQueryOperatorEnumerator`1.MoveNext(TOutput& currentElement, Pair`2& currentKey)
While calling the same thing without the AsParallel() works as expected.
To Reproduce
Load a module, and call moduleDef.GetAllTypes().AsParallel().SelectMany(t => t.Fields).Count(). As this is a thread-safety issue, it's possible you may have to call it multiple times to reproduce the issue.
Expected behavior
The total number of field definitions in the module is returned, but (hopefully) faster than doing so single-threaded.
Screenshots
N/A
Platform
OS: Windows 11
AsmResolver Version: 4.9.0
Additional context
N/A
The text was updated successfully, but these errors were encountered:
SamboyCoding
changed the title
[.NET] TypeDefinition.Fields isn't thread-safe
[.NET] TypeDefinition.Fields (and possibly other member getters) isn't thread-safe
Apr 22, 2022
Describe the bug
As discussed in discord, calling
Throws the following exception
While calling the same thing without the
AsParallel()
works as expected.To Reproduce
Load a module, and call
moduleDef.GetAllTypes().AsParallel().SelectMany(t => t.Fields).Count()
. As this is a thread-safety issue, it's possible you may have to call it multiple times to reproduce the issue.Expected behavior
The total number of field definitions in the module is returned, but (hopefully) faster than doing so single-threaded.
Screenshots
N/A
Platform
Additional context
N/A
The text was updated successfully, but these errors were encountered: