Skip to content

Bug: IsDictionaryStringObject() does not work in F# #789

@MatejMarecek

Description

@MatejMarecek

Bug Description

When using RepoDB in F#, passing Dictionary<string, Object> as an argument to operations does not work.

I think that root cause of the problem lies in method IsDictionaryStringObject where the dictionary object type is compared like this type == StaticType.IDictionaryStringObject.

Library Version:
1.12.7

image

Example code

let user = Dictionary<string, Object>()
patch.FirstName |> Option.iter (fun value -> user.Add("FirstName", value))
patch.LastName |> Option.iter (fun value -> user.Add("LastName", value))

let! updatedRows = connection.UpdateAsync("User", entity = user, where = where)

type data

result = {RuntimeType} System.Collections.Generic.Dictionary`2[System.String,System.Object]
 Assembly = {RuntimeAssembly} System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
 AssemblyQualifiedName = {string} "System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]],…"
 Attributes = {TypeAttributes} Public | Serializable | BeforeFieldInit
 BaseType = {RuntimeType} System.Object
 Cache = RuntimeType.RuntimeTypeCache
 CacheIfExists = RuntimeType.RuntimeTypeCache
 ContainsGenericParameters = {bool} false
 CustomAttributes = {ReadOnlyCollection<CustomAttributeData>} Count = 7
 DeclaredConstructors = {ConstructorInfo[]} ConstructorInfo[9]
 DeclaredEvents = {EventInfo[]} EventInfo[0]
 DeclaredFields = {FieldInfo[]} FieldInfo[10]
 DeclaredMembers = {MemberInfo[]} MemberInfo[92]
 DeclaredMethods = {MethodInfo[]} MethodInfo[52]
 DeclaredNestedTypes = TypeInfo.<get_DeclaredNestedTypes>d__22
 DeclaredProperties = {PropertyInfo[]} PropertyInfo[17]
 DeclaringMethod = {MethodBase} Exception of type 'System.InvalidOperationException' was thrown
 DeclaringType (MemberInfo) = {Type} null
 DeclaringType = {Type} null
 DomainInitialized = {bool} false
 FullName = {string} "System.Collections.Generic.Dictionary`2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]"
 GUID = {Guid} 1dfc9a85-8221-3436-a970-53bf17d74d39
 GenericCache = {object} null
 GenericParameterAttributes = {GenericParameterAttributes} Exception of type 'System.InvalidOperationException' was thrown
 GenericParameterPosition = {int} Exception of type 'System.InvalidOperationException' was thrown
 GenericTypeArguments = {Type[]} Type[2]
 GenericTypeParameters = {Type[]} Type[0]
 HasElementType = {bool} false
 ImplementedInterfaces = {Type[]} Type[10]
 IsAbstract = {bool} false
 IsAnsiClass = {bool} true
 IsArray = {bool} false
 IsAutoClass = {bool} false
 IsAutoLayout = {bool} true
 IsByRef = {bool} false
 IsByRefLike = {bool} false
 IsCOMObject = {bool} false
 IsClass = {bool} true
 IsCollectible = {bool} false
 IsConstructedGenericType = {bool} true
 IsContextful = {bool} false
 IsEnum = {bool} false
 IsExplicitLayout = {bool} false
 IsGenericMethodParameter = {bool} false
 IsGenericParameter = {bool} false
 IsGenericType = {bool} true
 IsGenericTypeDefinition = {bool} false
 IsGenericTypeParameter = {bool} false
 IsImport = {bool} false
 IsInterface = {bool} false
 IsLayoutSequential = {bool} false
 IsMarshalByRef = {bool} false
 IsNested = {bool} false
 IsNestedAssembly = {bool} false
 IsNestedFamANDAssem = {bool} false
 IsNestedFamORAssem = {bool} false
 IsNestedFamily = {bool} false
 IsNestedPrivate = {bool} false
 IsNestedPublic = {bool} false
 IsNotPublic = {bool} false
 IsPointer = {bool} false
 IsPrimitive = {bool} false
 IsPublic = {bool} true
 IsSZArray = {bool} false
 IsSealed = {bool} false
 IsSecurityCritical = {bool} true
 IsSecuritySafeCritical = {bool} false
 IsSecurityTransparent = {bool} false
 IsSerializable = {bool} true
 IsSignatureType = {bool} false
 IsSpecialName = {bool} false
 IsTypeDefinition = {bool} false
 IsUnicodeClass = {bool} false
 IsValueType = {bool} false
 IsVariableBoundArray = {bool} false
 IsVisible = {bool} true
 MemberType (MemberInfo) = {MemberTypes} TypeInfo
 MemberType = {MemberTypes} TypeInfo
 MetadataToken = {int} 33556451
 Module (MemberInfo) = {RuntimeModule} System.Private.CoreLib.dll
 Module = {RuntimeModule} System.Private.CoreLib.dll
 Name = {string} "Dictionary`2"
 Namespace = {string} "System.Collections.Generic"
 ReflectedType (MemberInfo) = {Type} null
 ReflectedType = {Type} null
 StructLayoutAttribute = StructLayoutAttribute
 TypeHandle = RuntimeTypeHandle
 TypeInitializer = {ConstructorInfo} null
 UnderlyingSystemType = {RuntimeType} System.Collections.Generic.Dictionary`2[System.String,System.Object]
 m_cache = {IntPtr} 0x272407527b8
 m_handle = {IntPtr} 0x7fff5a5ddd30
 m_keepalive = {object} null

StaticType.IDictionaryStringObject data

result = {RuntimeType} System.Collections.Generic.IDictionary`2[System.String,System.Object]
 Assembly = {RuntimeAssembly} System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
 AssemblyQualifiedName = {string} "System.Collections.Generic.IDictionary`2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]…"
 Attributes = {TypeAttributes} Public | ClassSemanticsMask | Interface | Abstract
 BaseType = {Type} null
 Cache = RuntimeType.RuntimeTypeCache
 CacheIfExists = RuntimeType.RuntimeTypeCache
 ContainsGenericParameters = {bool} false
 CustomAttributes = {ReadOnlyCollection<CustomAttributeData>} Count = 2
 DeclaredConstructors = {ConstructorInfo[]} ConstructorInfo[0]
 DeclaredEvents = {EventInfo[]} EventInfo[0]
 DeclaredFields = {FieldInfo[]} FieldInfo[0]
 DeclaredMembers = {MemberInfo[]} MemberInfo[11]
 DeclaredMethods = {MethodInfo[]} MethodInfo[8]
 DeclaredNestedTypes = TypeInfo.<get_DeclaredNestedTypes>d__22
 DeclaredProperties = {PropertyInfo[]} PropertyInfo[3]
 DeclaringMethod = {MethodBase} Exception of type 'System.InvalidOperationException' was thrown
 DeclaringType (MemberInfo) = {Type} null
 DeclaringType = {Type} null
 DomainInitialized = {bool} false
 FullName = {string} "System.Collections.Generic.IDictionary`2[[System.String, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]"
 GUID = {Guid} a799edaa-b36f-31da-9b95-d75be19d1ccc
 GenericCache = {object} null
 GenericParameterAttributes = {GenericParameterAttributes} Exception of type 'System.InvalidOperationException' was thrown
 GenericParameterPosition = {int} Exception of type 'System.InvalidOperationException' was thrown
 GenericTypeArguments = {Type[]} Type[2]
 GenericTypeParameters = {Type[]} Type[0]
 HasElementType = {bool} false
 ImplementedInterfaces = {Type[]} Type[3]
 IsAbstract = {bool} true
 IsAnsiClass = {bool} true
 IsArray = {bool} false
 IsAutoClass = {bool} false
 IsAutoLayout = {bool} true
 IsByRef = {bool} false
 IsByRefLike = {bool} false
 IsCOMObject = {bool} false
 IsClass = {bool} false
 IsCollectible = {bool} false
 IsConstructedGenericType = {bool} true
 IsContextful = {bool} false
 IsEnum = {bool} false
 IsExplicitLayout = {bool} false
 IsGenericMethodParameter = {bool} false
 IsGenericParameter = {bool} false
 IsGenericType = {bool} true
 IsGenericTypeDefinition = {bool} false
 IsGenericTypeParameter = {bool} false
 IsImport = {bool} false
 IsInterface = {bool} true
 IsLayoutSequential = {bool} false
 IsMarshalByRef = {bool} false
 IsNested = {bool} false
 IsNestedAssembly = {bool} false
 IsNestedFamANDAssem = {bool} false
 IsNestedFamORAssem = {bool} false
 IsNestedFamily = {bool} false
 IsNestedPrivate = {bool} false
 IsNestedPublic = {bool} false
 IsNotPublic = {bool} false
 IsPointer = {bool} false
 IsPrimitive = {bool} false
 IsPublic = {bool} true
 IsSZArray = {bool} false
 IsSealed = {bool} false
 IsSecurityCritical = {bool} true
 IsSecuritySafeCritical = {bool} false
 IsSecurityTransparent = {bool} false
 IsSerializable = {bool} false
 IsSignatureType = {bool} false
 IsSpecialName = {bool} false
 IsTypeDefinition = {bool} false
 IsUnicodeClass = {bool} false
 IsValueType = {bool} false
 IsVariableBoundArray = {bool} false
 IsVisible = {bool} true
 MemberType (MemberInfo) = {MemberTypes} TypeInfo
 MemberType = {MemberTypes} TypeInfo
 MetadataToken = {int} 33556467
 Module (MemberInfo) = {RuntimeModule} System.Private.CoreLib.dll
 Module = {RuntimeModule} System.Private.CoreLib.dll
 Name = {string} "IDictionary`2"
 Namespace = {string} "System.Collections.Generic"
 ReflectedType (MemberInfo) = {Type} null
 ReflectedType = {Type} null
 StructLayoutAttribute = {StructLayoutAttribute} null
 TypeHandle = RuntimeTypeHandle
 TypeInitializer = {ConstructorInfo} null
 UnderlyingSystemType = {RuntimeType} System.Collections.Generic.IDictionary`2[System.String,System.Object]
 m_cache = {IntPtr} 0x272407527b0
 m_handle = {IntPtr} 0x7fff5a5de748
 m_keepalive = {object} null

Stack trace

TypeExtension.IsDictionaryStringObject() at C:\Users\matej\AppData\Roaming\JetBrains\Rider2020.3\resharper-host\DecompilerCache\decompiler\2B1075D7-B7DF-431E-9AE4-B3722EBBCB1A\56\385aca96\TypeExtension.cs:line 56
DbConnectionExtension.UpdateAsyncInternal<object>() at C:\Users\matej\AppData\Roaming\JetBrains\Rider2020.3\resharper-host\DecompilerCache\decompiler\2B1075D7-B7DF-431E-9AE4-B3722EBBCB1A\0d\fbb91ff4\DbConnectionExtension.cs:line 28113
DbConnectionExtension.UpdateAsync() at C:\Users\matej\AppData\Roaming\JetBrains\Rider2020.3\resharper-host\DecompilerCache\decompiler\2B1075D7-B7DF-431E-9AE4-B3722EBBCB1A\0d\fbb91ff4\DbConnectionExtension.cs:line 28393
...

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingfixedThe bug, issue, incident has been fixed.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions