We suggest you ensure that projects in your XAF solution use project-to-project references instead of file assembly references. Microsoft recommends this as the best way to manage references in a project: https://docs.microsoft.com/en-us/visualstudio/ide/managing-references-in-a-project?view=vs-2019#project-to-project-references. Our Model Editor requires project-to-project references to collect accurate dependency information. If projects inside your XAF solution are added as file references, it may not only increase maintenance costs, but also cause "Dictionary already contains ClassInfo. Possible reason: the assembly has been loaded twice" errors in the Model Editor.
We avoided this behavior in the new Model Editor for .NET Core and .NET Standard projects (v20.1+), which uses a different architecture and out-of-Visual Studio process. For more information, please review the following help topics:
- FAQ: Model Editor for .NET Core and .NET Standard (CTP)
- Port an Existing XAF Application to .NET Core 3.0+
- How to port an XAF platform-agnostic module from .NET Framework to .NET Standard 2.0+
Hi guys,
This error is a result of a bug in Visual Studio: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=379324. I am afraid we cannot overcome it on our side.
EDIT: Microsoft said that they couldn't fix this problem of Visual Studio. So, I have posted ( http://social.msdn.microsoft.com/Forums/en-US/csharpide/thread/b7ee8b92-335d-4118-b609-eb7825c7d1a4 ) on their forum to see a feedback from other users and to gather votes or find a workaround for this issue.
Currently, you can use the following solutions:
- Reopen the Visual Studio when the "Dictionary already contains class info" error occurs;
- Simplify the Visual Studio solution's hierarchy by referencing an output assembly instead of referencing a project.
For instance, if the error mentioned the <YourSolutionName>.Module assembly, then you can reference its output assembly (<YourSolutionName>.Module.dll) instead of having its source added into your Visual Studio solution. - Use a standalone Model Editor tool (%ProgramFiles%\DevExpress 15.2\Components\Tools\eXpressAppFramework\Model Editor"
Hello,
Currently, XAF doesn't support this projects structure: [ObjectsLib + CommonModule + WinFormsModule + WinFormsApplication]
And, this structure is not supported by VisualStudio out of the box: an old assembly could be loaded after rebuilding an entire solution ( see also: B32244 ).
Thanks,
Dan