0
1

I have a simple 'user' entity that has a 'RowId' (key), username (string), password (string), isenabled (bool), an enum (uint, has [Flags] attached with valid values: 1, 2, ..., 64) to define the type of user and 2 datetime fields to store initial / last login.

I recreated the database (to start fresh), added a user using MSSql server management studio with valid information (for the enum value I entered '64', one of the valid options) and gave it a row id '0'.

I loop over all 'User' entities, and it could correctly find the newly added user.

I then tried adding the same user, but with a more valid row id '1'.

I then queried for all of the 'User' entities, but only the '0' one that I left in could be found: the '1' entry wasn't found. Even worse, it did find 2 entries BUT the 2nd entry was 'null'

Even worse, look at this screenshot:

Where(u => u != null) DOES return a 'null' reference!

The 'Where' doesn't matter, I just added it as an extra test, but even with this code, the foreach returns 1 valid option (the '0') one and a 'null' reference.

Whenever I add a row using the management studio with an id other than '0' it starts returning 'null' instead of the actual entity.

Is there something special that I need to do if I want to add a new row manually using the management studio? Or is this a (known) bug?

I do consider the fact that a 'Where (u => u != null)' can return a null absolutely a bug though.

Since I only need 1 user currently to proceed my work, I'm ok for now, but soon I'll need a solution for this issue. Any aid would be greatly appreciated.

asked Sep 16 '11 at 09:38

TimM's gravatar image

TimM
9779

Hello TimM,

I absolutely agree that this could be considered as a weird behavior. I'll check this.

(Sep 16 '11 at 10:39) Dmitri Maximov Dmitri%20Maximov's gravatar image

4 Answers:

Do you use ClientProfile?

answered Sep 19 '11 at 06:47

xumix's gravatar image

xumix
425747682

I use 'SessionOptions.ServerProfile | SessionOptions.AutoTransactionOpenMode | SessionOptions.AllowSwitching'

(Sep 19 '11 at 06:49) TimM TimM's gravatar image

Then this is really weird. Seems like a bug, I advise you to create a test project and reproduce the issue. Then send it to support@ xtensive

(Sep 19 '11 at 06:52) xumix xumix's gravatar image

TimM,

I tried to reproduce the case but I failed. DataObjects.Net honestly fetched both users for me.

Could you please provide me with a sample that demonstrate the behavior? The e-mail address is the same as xumix wrote (support at x-tensive.com).

Thanks.

answered Oct 02 '11 at 10:07

Dmitri%20Maximov's gravatar image

Dmitri Maximov
22111211

No, I don't have an example, but I can add some additional information.

I added a user with id 1 : didn't work, but if I added it with a very large id (100000) it did find the user!

Maybe related with the key generator?

(Oct 06 '11 at 09:14) TimM TimM's gravatar image

I'm afraid, this can't be connected with the key generator.

(Oct 12 '11 at 05:43) Dmitri Maximov Dmitri%20Maximov's gravatar image

TimM, is there a column named 'TypeId' in the table? If yes, does it has values for manually added records?

(Oct 12 '11 at 05:55) Dmitri Maximov Dmitri%20Maximov's gravatar image

No, see my new post for a screenshot of the table data.

(Oct 17 '11 at 03:33) TimM TimM's gravatar image

In reply to Dmitri:

screenshot

Not here at least, should I be looking at other tables (this is the 'UserEntity' table)

As you can see, I'm using ugly high row ids at the moment as a work around (I erased the username / password field for obvious reasons)

answered Oct 17 '11 at 03:33

TimM's gravatar image

TimM
9779

TimM,

Could you please check whether UserEntity type has DebuggerDisplay attribute applied or ToString method overridden? Debugger can display null when it can't build debug representation of an object.

answered Oct 18 '11 at 05:08

Dmitri%20Maximov's gravatar image

Dmitri Maximov
22111211

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