cake-build / cake-build/cake

ParseAssemblyInfo 'Error: Sequence contains more than one element' when using preprocessor definitions in assembly info file

Open
#1,660 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.2k
Forks
778
Avg merge
1h 15m
Merged PRs (30d)
19

Description

This happens even in newest Cake v0.20.0.

If we have a part in assembly info file like below

```
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Retail")]
#endif
```
It is simply failing because somewhere IEnumerable.Single() method is called and parser for some reason takes both of those assembly attributes definitions.

Contributor guide

Open the contributing guide

Research direction

Start by locating Cake's assembly-info parser and the IEnumerable.Single() call mentioned in the report. Reproduce the failure with the shown DEBUG and non-DEBUG AssemblyConfiguration attributes, then inspect existing parser tests if available. Done means the conditional definitions no longer cause the parser to throw for this example.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.