It seems that I have once again lost the ability to reproduce this issue, as unloading/loading the projects in the solution no longer force the errors. The below answers are to the best of my recolection from when the errors were occurring.
- Are there any other references from the failing project(s) to types within the project that contains ViewModelBase? Do any of these references throw errors?
The failures were contained to the project that also contained ViewModelBase. One of the failures (mentioned in this post:
http://forum.ncrunch.net...ut-has-wrong-count.aspx) was a class in the UI project calling into the constructor of a class in the Common project. The other errors were, as far as I can tell, restricted to classes in the UI project calling each other.
The project structure looks something like the below graph. Note: each of these is a library. The UI project and the AlternativeEntry project are both "plugins" to other applications.
MySolution
|- UI_Project
| |- Controls
| | |- Control1.xaml
| | | `- Control1.cs
| | `- Control2.xaml
| | `- Control2.cs
| |- ViewModels
| | |- ViewModelBase.cs
| | |- Control1ViewModel.cs
| | `- Control2ViewModel.cs
| |- Class1.cs
| `- Class2.cs
|
|- Common_Project
| |- Class1.cs
| `- Class2.cs
|
|- AlternativeEntry_Project
| |- Class1.cs
| `- Class2.cs
|
`- UnitTesting_Project
. |- Class1.cs
. `- Class2.cs
- Are you using the 'Copy assembly references to workspace' NCrunch configuration option for any of the projects in your solution?
Not currently, although at one point I turned it on for the UI project, then also the Common project, to see if it resolved the issues, but it did not, so I turned it back off.
- Do you have any additional complexity in your build process? Such as 3rd party tools, pre/post or custom build steps, etc
At the time of my original posting, the answer is "no". However, I've since added a post-build step to the AlternativeEntry project that copies the .dll file to additional locations in the solution folder structure.
- Does the problem resolve itself if you unload/reload the ViewModelBase project (to cause the problem), then try to rebuild one of the failing depending projects by right-clicking on it in the Tests Window and choosing to rebuild?
No. The only method I could find to resolve the issue was to manual edit each individual file that was listed as failing. Upon editing the one file, it would be removed from the list, as NCrunch would immediately register the change and recompile, however the remaining files would stay on the list until I had touched each in turn. (Re)Building from Visual Studio and/or from the NCrunch tests console had effect.
- Is there anything unusual about the way in which the ViewModelBase project is being referenced? For example, is it perhaps referenced using an <AssemblyReference> in the .proj file instead of a <ProjectReference>, or are you using the InternalsVisibleTo assembly attribute?
The references between projects in the solution are all project-based references. However, I am using the InternalsVisibleTo attribute within the Common project, which has no public API and all access from the other three projects is granted via internal visibility. Additionally, the UI, Common and AlternativeEntry projects grant InternalsVisibleTo to the unit test project.
Also of note: the ViewModelBase class itself is very straightforward. It implements INotifyPropertyChange with a single event PropertyChangedEvent and a property-name lookup helper method based on this:
http://wrightthisblog.bl...roperty-references.html
One other somewhat non-standard thing that might be interesting:
My company uses a "AssemblyInfoShared.cs" file that contains a common set of assembly-level attributes (AssemblyCompany, AssemblyTrademark, etc) which is added to each project via linked file from a common location outside this solution. This is in addition to the project-specific AssemblyInfo.cs. There are no overlaps between to two files.