Skip to content
This repository was archived by the owner on Apr 30, 2020. It is now read-only.
This repository was archived by the owner on Apr 30, 2020. It is now read-only.

Building documentation for two framework versions fails (Support multiple simultaneous framework versions) #87

Description

@qJake

Our code library contains the same code across projects, but there are two project libraries loaded, one for .NET 4 and one for .NET 4.5. There are some issues with this when sharpDox loads the solution:

  1. The type list contains two copies of the same classes with no way to distinguish them
  2. Excluding one class (e.g. the one from .NET 4.0) excludes it from .NET 4.5 also, once the exclusion list is reloaded
  3. Building the documentation with both loaded gives me the following error:
Starting step: "Parsing project file"
Starting step: "Parsing code"
Could not build documentation.
System.InvalidOperationException: Sequence contains more than one element
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
   at SharpDox.Build.Roslyn.Parser.ProjectParser.MethodCallParser.ParseMethodCalls()
   at SharpDox.Build.Roslyn.RoslynParser.ParseMethodCalls(ParserOptions parserOptions)
   at SharpDox.Build.Roslyn.RoslynParser.GetParsedSolution(String solutionFile, ICoreConfigSection sharpDoxConfig, Dictionary`2 tokens, Boolean parseMethodCalls, Boolean ignoreExcludes)
   at SharpDox.Build.Context.Step.ParseCodeStep.RunStep(SDProject sdProject)
   at SharpDox.Build.Context.BuildContext.StartBuild()

Here is a sample of the structure we have:

  • MyLibrary-net4
    • MyClass
      • MyMethod()
  • MyLibrary-net45
    • MyClass
      • MyMethod()

Since you are only using fully qualified method names as "unique names", if two projects are loaded with the same code, it will fail, because that .Single(...) call inside of ParseMethodCalls() is expecting one result, but instead it finds two identical ones:

  • MyLibrary.MyClass.MyMethod() [net4]
  • MyLibrary.MyClass.MyMethod() [net45]

I think the fix here is to prepend the Framework version to the exclusion/inclusion list, or at the very least, prepend the project name (project names are guaranteed to be unique within a solution IIRC).

The workaround was to create another solution with only one set of projects in it, so that code was not duplicated. Not ideal, though - I would like to use my main solution instead.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions