{"record":{"id":"8ccf5797cb47f432","repo":"HangfireIO/Hangfire","slug":"property-type-fullname-connection-not-found","errorCode":null,"errorMessage":"Property '{type.FullName}.Connection' not found.","messagePattern":"Property '(.+?)\\.Connection' not found\\.","errorType":"exception","errorClass":"MissingMemberException","httpStatus":null,"severity":"error","filePath":"src/Hangfire.SqlServer/SqlCommandSet.cs","lineNumber":81,"sourceCode":"                        // GitHub Issue: https://github.com/dotnet/corefx/issues/29391\n                        throw new NotSupportedException(\".NET Core version of the System.Data.SqlClient package below 4.7.0 (which has assembly version 4.6.0.0) doesn't properly implement the SqlCommandSet class.\");\n                    }\n\n                    var type = sqlClientAssembly.GetTypes().FirstOrDefault(static x => x.Name == \"SqlCommandSet\");\n                    if (type == null)\n                    {\n                        throw new TypeLoadException($\"Could not load type 'SqlCommandSet' from assembly '{sqlClientAssembly}'.\");\n                    }\n\n                    return type;\n                });\n\n                _setConnection = SetConnection.GetOrAdd(sqlCommandSetType, static type =>\n                {\n                    var p = Expression.Parameter(typeof(object));\n                    var converted = Expression.Convert(p, type);\n                    var connectionParameter = Expression.Parameter(typeof(DbConnection));\n                    var connectionProperty = type.GetProperty(\"Connection\", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? throw new MissingMemberException($\"Property '{type.FullName}.Connection' not found.\");\n                    return Expression.Lambda<Action<object, DbConnection>>(Expression.Assign(Expression.Property(converted, connectionProperty), Expression.Convert(connectionParameter, connectionProperty.PropertyType)), p, connectionParameter).Compile();\n                });\n                _setTransaction = SetTransaction.GetOrAdd(sqlCommandSetType, static type =>\n                {\n                    var p = Expression.Parameter(typeof(object));\n                    var converted = Expression.Convert(p, type);\n                    var transactionParameter = Expression.Parameter(typeof(DbTransaction));\n                    var transactionProperty = type.GetProperty(\"Transaction\", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? throw new MissingMemberException($\"Property '{type.FullName}.Transaction' not found.\");\n                    return Expression.Lambda<Action<object, DbTransaction>>(Expression.Assign(Expression.Property(converted, transactionProperty), Expression.Convert(transactionParameter, transactionProperty.PropertyType)), p, transactionParameter).Compile();\n                });\n                var batchCommandProperty = BatchCommandProperty.GetOrAdd(sqlCommandSetType, static type =>\n                {\n                    return type.GetProperty(\"BatchCommand\", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? throw new MissingMemberException($\"Property '{type.FullName}.BatchCommand' not found.\");\n                });\n                _getBatchCommand = GetBatchCommand.GetOrAdd(sqlCommandSetType, type =>\n                {\n                    var p = Expression.Parameter(typeof(object));\n                    var converted = Expression.Convert(p, type);","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/HangfireIO/Hangfire/blob/c236dd0f930f831ec151e436e138ddc429a02a72/src/Hangfire.SqlServer/SqlCommandSet.cs#L63-L99","documentation":"MissingMemberException thrown while building the expression to set the Connection property on the SqlCommandSet instance: GetProperty(\"Connection\", Instance|Public|NonPublic) returned null for the resolved type. Hangfire reflects non-public members of the batch type; if the provider renamed or removed the Connection setter, the accessor cannot be compiled.","triggerScenarios":"Using a SqlClient assembly whose SqlCommandSet type exists but no longer has a Connection property discoverable via reflection (renamed property, different visibility, obfuscation).","commonSituations":"Provider version change that altered internal property names; an obfuscated/trimmed assembly; using Microsoft.Data.SqlClient on a version where the internal surface differs.","solutions":["Use a SqlClient package version that is known compatible with your Hangfire.SqlServer version (check release notes).","Avoid assembly trimming/obfuscation on the SqlClient assembly.","Upgrade Hangfire.SqlServer to a release that supports the newer internal layout."],"exampleFix":"// before\n<PackageReference Include=\"Hangfire.SqlServer\" Version=\"1.6.x\" />\n<PackageReference Include=\"Microsoft.Data.SqlClient\" Version=\"5.0.0\" />\n\n// after (align versions per Hangfire.SqlServer release notes)\n<PackageReference Include=\"Hangfire.SqlServer\" Version=\"1.8.x\" />\n<PackageReference Include=\"Microsoft.Data.SqlClient\" Version=\"5.1.x\" />","handlingStrategy":"type-guard","validationCode":"static bool HasConnectionProperty(Type sqlCommandSetType)\n    => sqlCommandSetType.GetProperty(\"Connection\",\n        BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) != null;","typeGuard":"static bool IsSqlCommandSetUsable(Type type) =>\n    type.GetProperty(\"Connection\", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) != null;","tryCatchPattern":null,"preventionTips":["Avoid trimming/obfuscating the SqlClient assembly.","Keep Hangfire.SqlServer updated alongside SqlClient.","When evaluating a new provider, write a probe test that reflects the expected members."],"tags":["sqlserver","reflection","provider","compatibility"],"backgroundTag":null,"analyzedSha":"c236dd0f930f831ec151e436e138ddc429a02a72","analyzedAt":"2026-08-13T20:27:11.027Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}