Skip to content

NH-3865 - Swallowed ArgumentNullException with dynamic composite id #1047

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

Closed
nhibernate-bot opened this issue Oct 12, 2017 · 9 comments
Closed

Comments

@nhibernate-bot
Copy link
Collaborator

Kai Cissarek created an issue — 27th April 2016, 6:41:44:

Hi, the bug is related to https://nhibernate.jira.com/browse/NHE-91
its still unfixed and is very annoying because the appliation start is very slow with many audit tables.


Roger added a comment — 27th April 2016, 8:14:48:

I guess the reporter means that lots of ArgumentNullExceptions are thrown (and catched) internally in NH if you have a mapping with composite-id based on a dynamic entity
(this kind of mapping Envers is using for all of its mappings).


Kai Cissarek added a comment — 27th April 2016, 8:26:54:

yes, exactly :)

@hazzik
Copy link
Member

hazzik commented Dec 11, 2018

@RogerKratz is this still the case?

@RogerKratz
Copy link
Contributor

RogerKratz commented Dec 13, 2018

@hazzik Yes, this issue is still there.
What happens is... Envers uses composite-id mapping with no class set (because it's dynamic entities). That will lead to a lot of exceptions thrown in TypeNameParser.ParseTypeName(String typeName). These will be caught in Component.ComponentClass (one could argue that's bad that a general System.Exception is caught here).
In my opionion not that serious issue, but it would of course be good if it could be fixed not relying on try/catch-logic and all these thrown and catched exceptions.

Stack trace for all the exceptions...

System.ArgumentNullException: Value cannot be null.
Parameter name: typeName
  at at NHibernate.Util.TypeNameParser.ParseTypeName(String typeName)
  at at NHibernate.Util.TypeNameParser.Parse(String type, String defaultNamespace, String defaultAssembly)
  at at NHibernate.Util.TypeNameParser.Parse(String type)
  at at NHibernate.Util.ReflectHelper.ClassForName(String name)
  at at NHibernate.Mapping.Component.get_ComponentClass()

@hazzik
Copy link
Member

hazzik commented Dec 13, 2018

What’s the calls before get_ComponentClass?

@RogerKratz
Copy link
Contributor

RogerKratz commented Dec 14, 2018

Component.get_ComponentClass() in NHibernate.Mapping, NHibernate.dll
ClassCompositeIdBinder.BindComponent() in NHibernate.Cfg.XmlHbmBinding, NHibernate.dll
ClassCompositeIdBinder.BindCompositeId() in NHibernate.Cfg.XmlHbmBinding, NHibernate.dll
RootClassBinder.Bind() in NHibernate.Cfg.XmlHbmBinding, NHibernate.dll
MappingRootBinder.AddRootClasses() in NHibernate.Cfg.XmlHbmBinding, NHibernate.dll
MappingRootBinder.AddEntitiesMappings() in NHibernate.Cfg.XmlHbmBinding, NHibernate.dll
MappingRootBinder.Bind() in NHibernate.Cfg.XmlHbmBinding, NHibernate.dll
Configuration.AddDeserializedMapping() in NHibernate.Cfg, NHibernate.dll
Configuration.AddValidatedDocument() in NHibernate.Cfg, NHibernate.dll
Configuration.ProcessMappingsQueue() in NHibernate.Cfg, NHibernate.dll
Configuration.AddDocumentThroughQueue() in NHibernate.Cfg, NHibernate.dll
Configuration.AddXmlReader() in NHibernate.Cfg, NHibernate.dll
Configuration.AddXml() in NHibernate.Cfg, NHibernate.dll
Configuration.AddXml() in NHibernate.Cfg, NHibernate.dll
EntitiesConfigurator.Configure() in NHibernate.Envers.Configuration, NHibernate.Enver

@fredericDelaporte
Copy link
Member

A test case in NHibernate.Test triggering those swallowed exceptions would surely be the best thing for investigating the subject.

@RogerKratz
Copy link
Contributor

I can write some simple test case after the weekend. Not really simple to assert anything though, I guess.

@hazzik
Copy link
Member

hazzik commented Dec 14, 2018

It would be hard to write a test case for this. (I’ve happened to debug this code when was implementing dynamic entities).

@fredericDelaporte
Copy link
Member

Yes, since it is swallowed, there are no assert to write, and no failure to expect. But it may help checking how this swallowed exception could be avoided.

@RogerKratz
Copy link
Contributor

Example code available in this PR.

@fredericDelaporte fredericDelaporte changed the title NH-3865 - ArgumentNullException at IntegrateWithEnvers NH-3865 - Swallowed ArgumentNullException with dynamic composite id Dec 18, 2018
fredericDelaporte added a commit that referenced this issue Dec 19, 2018
@fredericDelaporte fredericDelaporte added this to the 5.3 milestone Dec 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants