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

Polyfill.IsNullable(this MemberInfo info) extension conflicts with my own #143

Closed
hazzik opened this issue Mar 11, 2024 · 1 comment · Fixed by #144
Closed

Polyfill.IsNullable(this MemberInfo info) extension conflicts with my own #143

hazzik opened this issue Mar 11, 2024 · 1 comment · Fixed by #144

Comments

@hazzik
Copy link
Contributor

hazzik commented Mar 11, 2024

Describe the bug

I had my own extension:

public static bool IsNullable(this Type type)
{ 
  return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>);
}

And Polyfill.IsNullable(this MemberInfo info) extensions takes precedence over mine. I suppose it happens because Polyfill is in root namespace and has more generic type.

This leads to the errors at runtime:

----> System.ArgumentException : Unsupported type:System.RuntimeType
  Stack Trace:
     at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() in /_/src/FluentNHibernate/Cfg/FluentConfiguration.cs:line 229
   at FluentNHibernate.SessionSource..ctor(FluentConfiguration config) in /_/src/FluentNHibernate/SessionSource.cs:line 40
   at FluentNHibernate.Testing.Testing.with_fluent_configuration.build_session_source() in /_/src/FluentNHibernate.Testing/Testing/SessionSourceConfigurationTester.cs:line 68
   at FluentNHibernate.Testing.Testing.when_using_a_session_source_and_schema.establish_context() in /_/src/FluentNHibernate.Testing/Testing/SessionSourceConfigurationTester.cs:line 38
   at FluentNHibernate.Testing.Specification.Setup() in /_/src/FluentNHibernate.Testing/Specification.cs:line 16
--FluentConfigurationException
   at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration() in /_/src/FluentNHibernate/Cfg/FluentConfiguration.cs:line 258
   at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() in /_/src/FluentNHibernate/Cfg/FluentConfiguration.cs:line 226
--ArgumentException
   at Polyfill.GetNullabilityInfo(MemberInfo info) in /_1/polyfill/3.0.0/contentFiles/cs/netstandard2.0/Polyfill/Nullability/NullabilityInfoExtensions.cs:line 39
   at FluentNHibernate.Mapping.PropertyPart.FluentNHibernate.Mapping.Providers.IPropertyMappingProvider.GetPropertyMapping() in /_/src/FluentNHibernate/Mapping/PropertyPart.cs:line 327
   at FluentNHibernate.Mapping.ClassMap`1.FluentNHibernate.IMappingProvider.GetClassMapping() in /_/src/FluentNHibernate/Mapping/ClassMap.cs:line 611
   at FluentNHibernate.PersistenceModel.BuildSeparateMappings(Action`1 add) in /_/src/FluentNHibernate/PersistenceModel.cs:line 180
   at FluentNHibernate.PersistenceModel.BuildMappings() in /_/src/FluentNHibernate/PersistenceModel.cs:line 167
   at FluentNHibernate.PersistenceModel.EnsureMappingsBuilt() in /_/src/FluentNHibernate/PersistenceModel.cs:line 220
   at FluentNHibernate.PersistenceModel.Configure(Configuration cfg) in /_/src/FluentNHibernate/PersistenceModel.cs:line 278
   at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration() in /_/src/FluentNHibernate/Cfg/FluentConfiguration.cs:line 250

Minimal Repro

Not so minimal: nhibernate/fluent-nhibernate#657

Submit a PR that fixes the bug

N/A

@SimonCropp
Copy link
Owner

i will change that to an op in api. new version eta tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants