codecov / codecov-exe

.exe report uploader for Codecov https://codecov.io
MIT License
25 stars 21 forks source link

Fix terminal filter #49

Closed ViktorHofer closed 5 years ago

ViktorHofer commented 5 years ago

If a terminal is not available the following exception is thrown as a collection is modified in a foreach statement.

Guidance

The foreach statement is used to iterate through the collection to get the information that you want, but can not be used to add or remove items from the source collection to avoid unpredictable side effects. If you need to add or remove items from the source collection, use a for loop.

Exception

          _____          _
         / ____|        | |
        | |     ___   __| | ___  ___ _____   __
        | |    / _ \ / _  |/ _ \/ __/ _ \ \ / /
        | |___| (_) | (_| |  __/ (_| (_) \ V /
         \_____\___/ \____|\___|\___\___/ \_/
                                     exe-1.2.0

2019-02-14 02:01:00 WRN No CI detected. 2019-02-14 02:01:01 FTL Collection was modified; enumeration operation may not execute. at System.Collections.Generic.Dictionary2.KeyCollection.Enumerator.MoveNext() at Codecov.Factories.TerminalFactory.Create() at Codecov.Program.UploadFacade.get_VersionControlSystem() at Codecov.Program.UploadFacade.Uploader() at Codecov.Program.Run.Runner(IEnumerable1 args)

Fix

Iterating on a temporary array instead of the collection directly.

ViktorHofer commented 5 years ago

Fixing another bug with powershell:

2019-02-14 02:54:24 FTL The given key 'Powershell' was not present in the dictionary. at System.Collections.Generic.Dictionary2.get_Item(TKey key) at Codecov.Upload.Uploads.SetUploaders(IUrl url, IReport report, IDictionary2 terminals) at Codecov.Upload.Uploads.<>c__DisplayClass1_0.<.ctor>b__0() at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy1.CreateValue() at Codecov.Upload.Uploads.get_Uploaders() at Codecov.Upload.Uploads.Uploader() at Codecov.Program.UploadFacade.Uploader() at Codecov.Program.Run.Uploader() at Codecov.Program.Run.Runner(IEnumerable1 args)

thomasrockhu commented 5 years ago

Thanks @ViktorHofer !