The following warnings were raised during initialisation of Naked Objects

Feb 8, 2012 at 4:03 AM

Morning.

Today I got this on my production site.

The following warnings were raised during initialisation of Naked Objects

  • Duplicate name: Length found on type: System.Array
  • Duplicate name: Long Length found on type: System.Array
  • Duplicate name: Rank found on type: System.Array
  • Duplicate name: Sync Root found on type: System.Array
  • Duplicate name: Is Read Only found on type: System.Array
  • Duplicate name: Is Fixed Size found on type: System.Array
  • Duplicate name: Is Synchronized found on type: System.Array

I restarted the website, and it went away.

Any ideas?

Coordinator
Feb 8, 2012 at 8:15 AM

No ideas, sorry.  The duplicate name warning is normally created by the Naked Objects reflector to warn against accidental duplication of names (of actions or properties typically) in a domain class  - for example if you have a string property called Name and another called FirstName, but you had also added DisplayName("Name") to the latter  -  which would cause ambiguity at run-time.  But there is no reason I can think of why the reflector should even be looking at System.Array.

The fact that it went away when you restarted suggests just some strange one-off abberation.  Watch out for it recurring, but I wouldn't worry too much

Editor
Feb 8, 2012 at 8:29 AM
On 8 February 2012 09:15, richardpawson <notifications@codeplex.com> wrote:

But there is no reason I can think of why the reflector should even be looking at System.Array.


Ultimately the reflector is traversing the object graph from a known entity via a property or collection to some related entity. I wonder if you have a property that returns an array, which is somehow not being automatically ignored by the reflector. If that's the case, you could perhaps add a [NakedObjectsIgnore] attribute.

Also, I wonder if the duplicate names is because there are actually two or more such properties returning arrays, eg one returning Foo[] and one returning Bar[]. Perhaps these ultimately are both just System.Array as the type, but in one case the reflector infers a name of "foo", and in the other "bar". ?

Reaching back, I remember that NOF used to define arrays as being valid collection types. Is this still the case, or does EF disallow it?

Dan


Feb 8, 2012 at 8:40 AM
Ok. Hope so. :)
Tnx much.
Coordinator
Feb 8, 2012 at 8:42 AM

FYI, EF does not allow Arrays as multiple associations -  they must be explicitly of type ICollection<T>.  As you say, though, it is possible that a domain object does have methods (or even non-persisted properties) that return an Array.  But the odd thing here is that the warnings have only appeared once apparently, then gone away  -  which is why I'm still thinking its an abberation.

Editor
Feb 8, 2012 at 8:47 AM
We walk the graph of NakedObjectSpecifications lazily; I wonder if there was some seldom-used property or collection that was accessed which isn't usually?


On 8 February 2012 09:43, richardpawson <notifications@codeplex.com> wrote:

From: richardpawson

FYI, EF does not allow Arrays as multiple associations - they must be explicitly of type ICollection<T>. As you say, though, it is possible that a domain object does have methods (or even non-persisted properties) that return an Array. But the odd thing here is that the warnings have only appeared once apparently, then gone away - which is why I'm still thinking its an abberation.

Read the full discussion online.

To add a post to this discussion, reply to this email (nakedobjects@discussions.codeplex.com)

To start a new discussion for this project, email nakedobjects@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Feb 8, 2012 at 8:53 AM
Ok. I agree with you. I definitely do not use arrays as multiple associations.
Tnx