Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
MatejMarecek opened this issue Mar 16, 2021 · 3 comments
Closed

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

MatejMarecek opened this issue Mar 16, 2021 · 3 comments
Assignees
Labels
bug Something isn't working fixed The bug, issue, incident has been fixed.

Comments

@MatejMarecek
Copy link

MatejMarecek commented Mar 16, 2021

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
...
@MatejMarecek MatejMarecek added the bug Something isn't working label Mar 16, 2021
@mikependon
Copy link
Owner

It seems that Dictionary<string, object> has not been resolved to the IDictionary<string, object>. Do you have the stack trace of the call?

@MatejMarecek
Copy link
Author

It seems that Dictionary<string, object> has not been resolved to the IDictionary<string, object>. Do you have the stack trace of the call?

The issue description was updated with the stack trace

mikependon added a commit that referenced this issue Mar 19, 2021
mikependon added a commit that referenced this issue Mar 19, 2021
@mikependon mikependon added the fixed The bug, issue, incident has been fixed. label Mar 19, 2021
@mikependon
Copy link
Owner

The fix for this will be available on the next release of the Core library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed The bug, issue, incident has been fixed.
Projects
None yet
Development

No branches or pull requests

2 participants