Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Issue with environment which supports environment variables with same name, different case #947

Open
6 of 29 tasks
fluffynuts opened this issue May 23, 2020 · 0 comments
Open
6 of 29 tasks

Comments

@fluffynuts
Copy link

Please provide the following information when submitting an issue.

Where appropriate replace the [ ] with a [X]

My Framework

  • .NET 2
  • .NET 3.5
  • .NET 4
  • .NET 4.5
  • .NET 4.6
  • .NET 4.6.1
  • .NET 4.6.2
  • .NET 4.7
  • .NET 4.7.1
  • .NET 4.7.2
  • .NET Core 1.0.0
  • .NET Core 2.0.0
  • Something else

My Environment

  • Windows 7 or below (not truly supported due to EOL)
  • Windows 8
  • Windows 8.1
  • Windows 10
  • Windows 10 IoT Core
  • Windows Server 2012
  • Windows Server 2012 R2
  • Windows Server 2016
  • Windows Server 2019

I have already...

  • repeated the problem using the latest stable release of OpenCover.
  • reviewed the usage guide and usage document.
  • have looked at the opencover output xml file in an attempt to resolve the issue.
  • reviewed the current issues to check that the issue isn't already known.

My issue is related to (check only those which apply):

  • no coverage being recorded
  • 32 or 64 bit support
  • feature request

Expected Behavior

Should run as before

Actual Behavior

WIndows Server 2019 is being provided as free CI environments, eg on GitHub (actions). I've seen this at another hosted CI environment, but just dismissed it. I see errors like:

 Unhandled Exception: System.ArgumentException: Item has already been added. Key in dictionary: 'NPM_CONFIG_PREFIX'  Key being added: 'npm_config_prefix'
   at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
   at System.Diagnostics.ProcessStartInfo.get_EnvironmentVariables()
   at OpenCover.Console.Program.RunProcess(CommandLineParser parser, Action`1 environment) in C:\projects\opencover\main\OpenCover.Console\Program.cs:line 309
   at OpenCover.Console.Program.<>c__DisplayClass2_0.<RunWithContainer>b__1(Action`1 environment) in C:\projects\opencover\main\OpenCover.Console\Program.cs:line 118
   at OpenCover.Framework.Manager.ProfilerManager.<>c__DisplayClass21_0.<SetProfilerAttributes>b__0(Object state) in C:\projects\opencover\main\OpenCover.Framework\Manager\ProfilerManager.cs:line 132
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

causing OpenCover to die. This is not an issue on most windows platforms as environment variables are case-insensitive, however, 2019 is upping the ante. Perhaps the collation of environment variables should either not use a case-insensitive hash-table, or should select one var over another. I tried to make that happen externally via my launcher, but it seems that I've had no effect.

Steps to reproduce the problem:

I think you should be able to fork https://github.com/fluffynuts/PeanutButter and repro the issue at commit ccbdb2aa74acba05dc90cf2b9a2bce959c766c7d. After that, I've reverted to using dotCover as it doesn't fail -- however OpenCover reports are a lot more useful, so I'd really prefer to use OpenCover.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants