Skip to content
This repository has been 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

Open
qJake opened this issue Jun 13, 2017 · 1 comment
Assignees
Labels

Comments

@qJake
Copy link

qJake commented Jun 13, 2017

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.

@geaz
Copy link
Owner

geaz commented Jun 17, 2017

This seems like a bug. sharpDox should know the difference between the different framework version. I will look into it as soon as possible.

@geaz geaz added the bug label Jun 17, 2017
@geaz geaz self-assigned this Jun 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants