I read the following blog post regarding the new xaml editing features available in VS2013:
http://blogs.msdn.com/b/visualstudio/archive/2013/08/09/xaml-editor-improvements-in-visual-studio-2013.aspx
Data binding Intellisense is something I've been wanting for ages, so I gave it a try - but unfortunately it's returning an error in the error list (though it still builds fine).
This is what I've added to my UserControl declaration / tag:
d:DataContext="{d:DesignInstance Type=lTemplates:TemplateEditorCustomVM}"
This is the error in the list:
Error 95 Access is denied: System.Collections.ObjectModel.ObservableCollection'1[_.di1.TemplateEditorCustomVM+TemplateCriteriaVM]'.
I'm not entirely sure what it's attempting to do, both classes are declared as public (main view model and a nested class).
Anyone got any ideas?
If not it's not the end of the world, as Resource Key Intellisense appears to work which is still a huge bonus.
Edit
OK - I moved the nested classes out into the public namespace, and VS has given me a more detailed error:
Error 64 Attempt by method '_.di1.Templates.TemplateEditorCustomVM..ctor()' to access method 'System.ComponentModel.BindingList'1<System.__Canon>..ctor()'
failed.
I'm a little confused I must say:
Firstly, why would intellisense need to instantiate the VM class, all it should care about is what properties are available and what type they are - all of which can be retrieved with reflection.
Secondly I don't understand why its erroring when it runs fine when the application is started.
I may have to do the old trick of having visual studio debug itself running the designer to see what it's attempting to do...
further edit
Right, I changed the BindingList properties to straight forward List properties (as the BindingList is from the WinForms side of things so I thought this might be worth changing to see what it does). But I got a similar error:
Error 64 Attempt by method '_.di3.Templates.TemplateEditorCustomVM..ctor()' to access method 'System.Collections.Generic.List'1<System.__Canon>..ctor()' failed.
I did a quick google on System.__Canon and its just a optimization detail :
https://stackoverflow.com/a/16856205/182568
Though still no closer to sussing out whats going on, ah well I'll keep digging further.
edit - now have a repo
Right, I began commenting out huge chunks of the VM to try to get to the bottom of this out of curiosity - and I now have a VM class which appears to reproduce the issue:
public class Nested
{
public class TestCheck
{
public int One { get; set; }
public int Two { get; set; }
}
}
public class SanityTestVM
{
public List<Nested.TestCheck> Test { get; set; }
}
Gives:
Error 14 Attempt by method '_.di14.Templates.SanityTestVM..ctor()' to access method 'System.Collections.Generic.List'1<System.__Canon>..ctor()' failed.
It appears the issue is having a List which has a nested class for its type - if its a normal class (non nested), everything is fine.
I think I'm going to need to submit a connect case for this - before I do is anyone able to confirm this, I have 4 versions of VS on a Windows 8.1 machine and I just want to rule the development environment out.