Hi,

Having an UpgradeHandler cause an exception in RecreateMode: is something wrong, or is this a bug?

I've joined a simple sample : [attachment=0:30why9qa]DOSample.zip[/attachment:30why9qa]

Edit: exception thrown

L'exception System.MethodAccessException s'est produite
  Message=".Create()"
  Source="Anonymously Hosted DynamicMethods Assembly"
  StackTrace:
       à Create()
       à Xtensive.Core.IoC.ServiceContainer.CreateInstance(ServiceRegistration serviceInfo)
       à Xtensive.Core.IoC.ServiceContainer.<GetOrCreateInstances>d__2.MoveNext()
       à System.Linq.Enumerable.<ConcatIterator>d__71`1.MoveNext()
       à System.Linq.Enumerable.<CastIterator>d__aa`1.MoveNext()
       à System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
       à System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
       à System.Linq.Lookup`2.Create[TSource](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
       à System.Linq.GroupedEnumerable`3.GetEnumerator()
       à Xtensive.Storage.Upgrade.UpgradeContext.BuildUpgradeHandlers()
       à Xtensive.Storage.Upgrade.UpgradeContext..ctor(DomainConfiguration originalConfiguration)
       à Xtensive.Storage.Upgrade.UpgradingDomainBuilder.Build(DomainConfiguration configuration)
       à Xtensive.Storage.Domain.Build(DomainConfiguration configuration)
       à ...

Regards,


Updated at 16.04.2010 9:30:54

Yes the sample I posted runs with a public Upgrader class.

A more specific exception would be a good idea.

By the way, why do you search the Upgrader classes on recreate?


Updated at 19.04.2010 8:56:37

That's OK for me. Besides it makes sense to check Upgrader type are correctly defined even in Recreate mode, so that we can spot an error as soon as possible when coding.

This thread was imported from our support forum. The original discussion may contain more detailed answer.

asked Apr 15 '10 at 16:07

olorin's gravatar image

olorin
358878792

edited Sep 08 '10 at 06:11

Alex%20Yakunin's gravatar image

Alex Yakunin
29714412

I just don't want to touch the code that works ;)

Concerning exception message - true, this must be fixed.

(Apr 15 '10 at 16:07) Alex Yakunin Alex%20Yakunin's gravatar image

> By the way, why do you search the Upgrader classes on recreate?

Just because there is a generic logic responsible for this. Not sure if it's necessary to fix this - i.e. does this lead to any issues?

(Apr 15 '10 at 16:07) Alex Yakunin Alex%20Yakunin's gravatar image

Most likely cause: class Upgrader must be public.

(Apr 15 '10 at 16:07) Alex Yakunin Alex%20Yakunin's gravatar image

Hello olorin,

We'll check the issue with IoC behavior and the necessity of searching for Upgraders in Recreate mode. At first glance, the latter one seems to be redundant.

(Apr 15 '10 at 16:07) Dmitri Maximov Dmitri%20Maximov's gravatar image

One Answer:

Upgrader must be public.

answered Sep 07 '10 at 04:14

olorin's gravatar image

olorin
358878792

Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA