premake / premake/premake-core

C# backend error with filters (fcfg is nil in dotnet.lua)

Open
#589 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement gmake
Dominant language
C
Stars
3.6k
Forks
654
Avg merge
1d 1h
Merged PRs (30d)
13

Description

So I was changing some code I have to use per-configuration filters like the following:

  filter { "system:windows", "architecture:x86" }
    files { "CSharp/i686-pc-win32-msvc/**.cs" }

  filter { "system:windows", "architecture:x86_64" }
    files { "CSharp/x86_64-pc-win32-msvc/**.cs" }

  filter { "system:macosx", "architecture:x86" }
    files { "CSharp/i686-apple-darwin12.4.0/**.cs" }

  filter { "system:macosx", "architecture:x86_64" }
    files { "CSharp/x86_64-apple-darwin12.4.0/**.cs" }

And now I get:

stack traceback:
    /Users/joao/Dev/premake-core/src/tools/dotnet.lua:35: in function 'fileinfo'
    ...ao/Dev/premake-core/src/actions/make/make_csharp.lua:294: in function 'selector'
    ...ao/Dev/premake-core/src/actions/make/make_csharp.lua:116: in function 'onleaf'
    /Users/joao/Dev/premake-core/src/base/tree.lua:241: in function 'donode'
    /Users/joao/Dev/premake-core/src/base/tree.lua:251: in function 'dochildren'
    /Users/joao/Dev/premake-core/src/base/tree.lua:235: in function 'donode'
    /Users/joao/Dev/premake-core/src/base/tree.lua:251: in function 'dochildren'
    /Users/joao/Dev/premake-core/src/base/tree.lua:235: in function 'donode'
    /Users/joao/Dev/premake-core/src/base/tree.lua:251: in function 'dochildren'
    /Users/joao/Dev/premake-core/src/base/tree.lua:266: in function 'traverse'
    ...ao/Dev/premake-core/src/actions/make/make_csharp.lua:114: in function 'listsources'
    ...ao/Dev/premake-core/src/actions/make/make_csharp.lua:292: in function '?'
    ...Users/joao/Dev/premake-core/src/base/_foundation.lua:108: in function 'callArray'
    ...ao/Dev/premake-core/src/actions/make/make_csharp.lua:57: in function 'callback'
    /Users/joao/Dev/premake-core/src/base/premake.lua:155: in function 'fn'
    /Users/joao/Dev/premake-core/src/base/premake.lua:49: in function 'capture'
    /Users/joao/Dev/premake-core/src/base/premake.lua:153: in function 'generate'
    ...ers/joao/Dev/premake-core/src/actions/make/_make.lua:46: in function 'onProject'
    /Users/joao/Dev/premake-core/src/base/action.lua:108: in function 'call'
    /Users/joao/Dev/premake-core/src/_premake_main.lua:330: in function '?'
    ...Users/joao/Dev/premake-core/src/base/_foundation.lua:108: in function 'callArray'
    /Users/joao/Dev/premake-core/src/_premake_main.lua:371: in function </Users/joao/Dev/premake-core/src/_premake_main.lua:370>
Error: /Users/joao/Dev/premake-core/src/tools/dotnet.lua:38: attempt to index local 'fcfg' (a nil value)

If I remove the last filter block then the error goes away.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the per-configuration filter blocks shown in the issue, then inspect src/tools/dotnet.lua around lines 35-38 and the callers in src/actions/make/make_csharp.lua. Trace why the matching configuration is absent and verify that C# makefile generation completes without indexing a nil configuration.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.