This project has moved and is read-only. For the latest updates, please go here.

Cannot change Identity?

Jan 4, 2012 at 2:52 PM
Edited Jan 4, 2012 at 3:16 PM

Hi guys,

I'm taking another shot at using Agfx to read data from a MediaWiki site (my last attempt failed but that was a few months ago). Everything comes back and (if I ignore the exceptions) I get what I'm after. However on binding to a list I'm getting a message "Identity cannot be changed". The callstack is trying to set the identity inside of Agfx (not sure exactly where as I don't have a debug version installed right now).

Here's my load context for the item:


public class CategoryLoadContext : LoadContext
        public CategoryLoadContext(string category) : base(category)

        public string Category
            get { return (string) Identity; }


There's no setter (as I don't think there should be?). I'm basically just setting things up like the feature walkthrough. Am I doing something silly here? (I can post other snippets of code if needed).


Edit: I found the error only pops its head up when I'm running with the debugger. Just running normally or in release mode and it works fine.

Jan 4, 2012 at 9:05 PM

Hi - 

This happens when you're trying to set the Identity property of a VM after it's already been set.


MyVM foo = new MyVM();

foo.Identity = "A"; // ok

foo.Identity = "B"; // error


So typically what's going on is that you're reusing an existing VM instance somewhere when you should be creating a new one, such as in your deserialize method.

Break on that Exception and see who's trying to set the value and what's already in there.