Winforms: Debug.Assert failures don't appear in the CI

Created on 30 Dec 2018  Â·  20Comments  Â·  Source: dotnet/winforms

E.g. in https://github.com/dotnet/winforms/pull/274 all the Debug CI says is: https://dnceng.visualstudio.com/public/_build/results?buildId=64113
image

2018-12-30T00:24:03.6894940Z ##[section]Starting: Windows Build / Publish
2018-12-30T00:24:03.6898330Z ==============================================================================
2018-12-30T00:24:03.6898453Z Task         : Command Line
2018-12-30T00:24:03.6898561Z Description  : Run a command line script using cmd.exe on Windows and bash on macOS and Linux.
2018-12-30T00:24:03.6899122Z Version      : 2.142.2
2018-12-30T00:24:03.6899213Z Author       : Microsoft Corporation
2018-12-30T00:24:03.6899310Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613735)
2018-12-30T00:24:03.6899415Z ==============================================================================
2018-12-30T00:24:04.6567772Z Generating script.
2018-12-30T00:24:04.6682829Z Script contents:
2018-12-30T00:24:04.6688452Z eng\common\cibuild.cmd -configuration Debug -prepareMachine   
2018-12-30T00:24:04.7248531Z ##[command]"C:\Windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "F:\vsagent\_temp\8a2c7d10-e0e1-452c-b838-667c67b22baa.cmd""
2018-12-30T00:24:05.9551282Z dotnet-install: Downloading link: https://dotnetcli.azureedge.net/dotnet/Sdk/3.0.100-preview-009820/dotnet-sdk-3.0.100-preview-009820-win-x64.zip
2018-12-30T00:24:07.0731103Z dotnet-install: Extracting zip from https://dotnetcli.azureedge.net/dotnet/Sdk/3.0.100-preview-009820/dotnet-sdk-3.0.100-preview-009820-win-x64.zip
2018-12-30T00:24:36.1620892Z dotnet-install: Adding to current process PATH: "F:\vsagent\68\s\.dotnet\". Note: This change will not be visible if PowerShell was run as a child process.
2018-12-30T00:24:36.1648616Z dotnet-install: Installation finished
2018-12-30T00:24:36.9903158Z F:\vsagent\68\s\.dotnet\sdk\3.0.100-preview-009820\MSBuild.dll /noconsolelogger /nologo -maxcpucount /m -verbosity:m /v:minimal /bl:F:\vsagent\68\s\artifacts\log\Debug\ToolsetRestore.binlog /clp:Summary /nr:False /p:TreatWarningsAsErrors=true /p:__ToolsetLocationOutputFile=F:\vsagent\68\s\artifacts\toolset\1.0.0-beta.18621.6.txt /t:__WriteToolsetLocation /warnaserror F:\vsagent\68\s\artifacts\toolset\restore.proj
2018-12-30T00:24:39.2958371Z F:\vsagent\68\s\.dotnet\sdk\3.0.100-preview-009820\MSBuild.dll /nologo -maxcpucount /m -verbosity:m /v:minimal /bl:F:\vsagent\68\s\artifacts\log\Debug\Build.binlog /clp:Summary /nr:False /p:TreatWarningsAsErrors=true /p:Configuration=Debug /p:RepoRoot=F:\vsagent\68\s /p:Restore=True /p:DeployDeps=False /p:Build=True /p:Rebuild=False /p:Deploy=False /p:Test=True /p:Pack=True /p:IntegrationTest=False /p:PerformanceTest=False /p:Sign=True /p:Publish=True /p:Execute=False /p:ContinuousIntegrationBuild=True /warnaserror F:\vsagent\68\s\.packages\microsoft.dotnet.arcade.sdk\1.0.0-beta.18621.6\tools\Build.proj
2018-12-30T00:24:40.1225991Z   Restoring packages for F:\vsagent\68\s\.packages\microsoft.dotnet.arcade.sdk\1.0.0-beta.18621.6\tools\Tools.proj...
2018-12-30T00:24:40.4269149Z   Installing Microsoft.DotNet.SignTool 1.0.0-beta.18614.3.
2018-12-30T00:24:40.4391741Z   Installing Microsoft.DiaSymReader.Pdb2Pdb 1.1.0-beta1-62506-02.
2018-12-30T00:24:40.4414855Z   Installing vswhere 2.5.2.
2018-12-30T00:24:40.4433337Z   Installing MicroBuild.Core.Sentinel 1.0.0.
2018-12-30T00:24:40.4434326Z   Installing MicroBuild.Core 0.2.0.
2018-12-30T00:24:40.4648599Z   Installing sn 1.0.0.
2018-12-30T00:24:41.0802625Z   Generating MSBuild file F:\vsagent\68\s\artifacts\toolset\Common\Tools.proj.nuget.g.props.
2018-12-30T00:24:41.0890572Z   Generating MSBuild file F:\vsagent\68\s\artifacts\toolset\Common\Tools.proj.nuget.g.targets.
2018-12-30T00:24:41.1104181Z   Restore completed in 974.54 ms for F:\vsagent\68\s\.packages\microsoft.dotnet.arcade.sdk\1.0.0-beta.18621.6\tools\Tools.proj.
2018-12-30T00:24:43.0967699Z   Restoring packages for F:\vsagent\68\s\src\System.Drawing.Design\src\System.Drawing.Design.Facade.csproj...
2018-12-30T00:24:43.0968188Z   Restoring packages for F:\vsagent\68\s\src\System.Design\src\System.Design.Facade.csproj...
2018-12-30T00:24:43.0968494Z   Restoring packages for F:\vsagent\68\s\pkg\Microsoft.Private.Winforms.csproj...
2018-12-30T00:24:43.0971596Z   Restoring packages for F:\vsagent\68\s\src\System.Windows.Forms.Design.Editors\ref\System.Windows.Forms.Design.Editors.Ref.csproj...
2018-12-30T00:24:43.7209738Z   Installing Microsoft.NETCore.DotNetAppHost 3.0.0-preview-27205-02.
2018-12-30T00:24:43.7224683Z   Installing Microsoft.Win32.SystemEvents 4.6.0-preview.18563.5.
2018-12-30T00:24:43.7230327Z   Installing System.Security.Permissions 4.6.0-preview.18606.1.
2018-12-30T00:24:43.7233975Z   Installing System.Security.Principal.Windows 4.6.0-preview.18606.1.
2018-12-30T00:24:43.7259418Z   Installing System.Security.Cryptography.ProtectedData 4.6.0-preview.18606.1.
2018-12-30T00:24:43.8148539Z   Installing System.Security.AccessControl 4.6.0-preview.18606.1.
2018-12-30T00:24:43.8651874Z   Installing Microsoft.NETCore.Platforms 2.0.0.
2018-12-30T00:24:44.1273970Z   Installing Microsoft.NETCore.DotNetHostResolver 3.0.0-preview-27205-02.
2018-12-30T00:24:44.1274434Z   Installing Microsoft.NETCore.Platforms 3.0.0-preview.18606.1.
2018-12-30T00:24:44.2695456Z   Installing System.Drawing.Common 4.6.0-preview.18563.5.
2018-12-30T00:24:44.3818467Z   Installing System.Configuration.ConfigurationManager 4.6.0-preview.18606.1.
2018-12-30T00:24:44.4959196Z   Installing System.Security.Cryptography.Cng 4.6.0-preview.18606.1.
2018-12-30T00:24:44.6204416Z   Installing Microsoft.Win32.Registry 4.6.0-preview.18606.1.
2018-12-30T00:24:44.6205140Z   Installing System.Media.SoundPlayer 4.6.0-alpha-27122-5.
2018-12-30T00:24:44.7250017Z   Installing Accessibility 4.6.0-alpha-27122-5.
2018-12-30T00:24:44.7906378Z   Installing NETStandard.Library 2.0.3.
2018-12-30T00:24:44.9061292Z   Installing Microsoft.Win32.SystemEvents 4.6.0-preview.18606.1.
2018-12-30T00:24:44.9311437Z   Installing Microsoft.NETCore.Targets 2.0.0.
2018-12-30T00:24:44.9400130Z   Installing System.Drawing.Common 4.6.0-preview.18606.1.
2018-12-30T00:24:44.9400973Z   Installing Microsoft.NETCore.Platforms 3.0.0-preview.18605.1.
2018-12-30T00:24:44.9584058Z   Installing Microsoft.NETCore.DotNetHostPolicy 3.0.0-preview-27205-02.
2018-12-30T00:24:44.9584728Z   Installing Microsoft.Build.Tasks.Git 1.0.0-beta2-18618-05.
2018-12-30T00:24:46.4601986Z   Installing Microsoft.SourceLink.Vsts.Git 1.0.0-beta2-18618-05.
2018-12-30T00:24:46.4604547Z   Installing System.CodeDom 4.6.0-preview.18606.1.
2018-12-30T00:24:46.4605145Z   Installing Microsoft.SourceLink.GitHub 1.0.0-beta2-18618-05.
2018-12-30T00:24:46.4605632Z   Installing System.Drawing.Design.Primitives 4.6.0-preview.18563.5.
2018-12-30T00:24:46.4606072Z   Installing XliffTasks 0.2.0-beta-63004-01.
2018-12-30T00:24:46.4606492Z   Installing Microsoft.NETCore.App 3.0.0-preview-27205-02.
2018-12-30T00:24:46.4606917Z   Installing Microsoft.SourceLink.Common 1.0.0-beta2-18618-05.
2018-12-30T00:24:46.4607333Z   Installing Microsoft.TargetingPack.NETFramework.v4.7.2 1.0.0.
2018-12-30T00:24:46.4607748Z   Installing Microsoft.DotNet.GenFacades 1.0.0-beta.18570.9.
2018-12-30T00:24:51.8423361Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\Microsoft.Private.Winforms\Microsoft.Private.Winforms.csproj.nuget.g.props.
2018-12-30T00:24:51.8481393Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Windows.Forms.Design.Editors.Ref\System.Windows.Forms.Design.Editors.Ref.csproj.nuget.g.props.
2018-12-30T00:24:51.8503909Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Drawing.Design.Facade\System.Drawing.Design.Facade.csproj.nuget.g.props.
2018-12-30T00:24:51.8577809Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Design.Facade\System.Design.Facade.csproj.nuget.g.props.
2018-12-30T00:24:51.8578377Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Windows.Forms.Design.Editors.Ref\System.Windows.Forms.Design.Editors.Ref.csproj.nuget.g.targets.
2018-12-30T00:24:51.8582526Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\Microsoft.Private.Winforms\Microsoft.Private.Winforms.csproj.nuget.g.targets.
2018-12-30T00:24:51.8582938Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Drawing.Design.Facade\System.Drawing.Design.Facade.csproj.nuget.g.targets.
2018-12-30T00:24:51.8601787Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Design.Facade\System.Design.Facade.csproj.nuget.g.targets.
2018-12-30T00:24:51.8825602Z   Restore completed in 8.79 sec for F:\vsagent\68\s\src\System.Design\src\System.Design.Facade.csproj.
2018-12-30T00:24:51.8840566Z   Restoring packages for F:\vsagent\68\s\src\System.Windows.Forms.Design.Editors\src\System.Windows.Forms.Design.Editors.csproj...
2018-12-30T00:24:51.8842103Z   Restore completed in 8.74 sec for F:\vsagent\68\s\src\System.Windows.Forms.Design.Editors\ref\System.Windows.Forms.Design.Editors.Ref.csproj.
2018-12-30T00:24:51.8851975Z   Restoring packages for F:\vsagent\68\s\src\System.Windows.Forms.Design.Editors\tests\UnitTests\System.Windows.Forms.Design.Editors.Tests.csproj...
2018-12-30T00:24:51.8852329Z   Restore completed in 8.78 sec for F:\vsagent\68\s\pkg\Microsoft.Private.Winforms.csproj.
2018-12-30T00:24:51.8859382Z   Restoring packages for F:\vsagent\68\s\src\System.Windows.Forms.Design\ref\System.Windows.Forms.Design.Ref.csproj...
2018-12-30T00:24:51.9573922Z   Restore completed in 8.78 sec for F:\vsagent\68\s\src\System.Drawing.Design\src\System.Drawing.Design.Facade.csproj.
2018-12-30T00:24:51.9575669Z   Restoring packages for F:\vsagent\68\s\src\System.Windows.Forms.Design\src\System.Windows.Forms.Design.csproj...
2018-12-30T00:24:51.9578340Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Windows.Forms.Design.Ref\System.Windows.Forms.Design.Ref.csproj.nuget.g.props.
2018-12-30T00:24:51.9579016Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Windows.Forms.Design.Editors\System.Windows.Forms.Design.Editors.csproj.nuget.g.props.
2018-12-30T00:24:51.9585980Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Windows.Forms.Design\System.Windows.Forms.Design.csproj.nuget.g.props.
2018-12-30T00:24:51.9586601Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Windows.Forms.Design.Editors\System.Windows.Forms.Design.Editors.csproj.nuget.g.targets.
2018-12-30T00:24:51.9587122Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Windows.Forms.Design.Ref\System.Windows.Forms.Design.Ref.csproj.nuget.g.targets.
2018-12-30T00:24:51.9590489Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Windows.Forms.Design\System.Windows.Forms.Design.csproj.nuget.g.targets.
2018-12-30T00:24:51.9683884Z   Restore completed in 25.02 ms for F:\vsagent\68\s\src\System.Windows.Forms.Design\ref\System.Windows.Forms.Design.Ref.csproj.
2018-12-30T00:24:51.9695549Z   Restore completed in 28 ms for F:\vsagent\68\s\src\System.Windows.Forms.Design.Editors\src\System.Windows.Forms.Design.Editors.csproj.
2018-12-30T00:24:51.9696247Z   Restoring packages for F:\vsagent\68\s\src\System.Windows.Forms.Design\tests\System.Windows.Forms.Design.Tests.csproj...
2018-12-30T00:24:51.9696757Z   Restoring packages for F:\vsagent\68\s\src\System.Windows.Forms\ref\System.Windows.Forms.Ref.csproj...
2018-12-30T00:24:51.9697361Z   Restore completed in 29.47 ms for F:\vsagent\68\s\src\System.Windows.Forms.Design\src\System.Windows.Forms.Design.csproj.
2018-12-30T00:24:52.0357082Z   Restoring packages for F:\vsagent\68\s\src\System.Windows.Forms\src\System.Windows.Forms.csproj...
2018-12-30T00:24:52.0357895Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Windows.Forms.Ref\System.Windows.Forms.Ref.csproj.nuget.g.props.
2018-12-30T00:24:52.0517644Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Windows.Forms\System.Windows.Forms.csproj.nuget.g.props.
2018-12-30T00:24:52.0518115Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Windows.Forms.Ref\System.Windows.Forms.Ref.csproj.nuget.g.targets.
2018-12-30T00:24:52.0518408Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Windows.Forms\System.Windows.Forms.csproj.nuget.g.targets.
2018-12-30T00:24:52.0518713Z   Restore completed in 23.27 ms for F:\vsagent\68\s\src\System.Windows.Forms\ref\System.Windows.Forms.Ref.csproj.
2018-12-30T00:24:52.0520069Z   Restore completed in 26.4 ms for F:\vsagent\68\s\src\System.Windows.Forms\src\System.Windows.Forms.csproj.
2018-12-30T00:24:52.0520406Z   Restoring packages for F:\vsagent\68\s\src\System.Windows.Forms\tests\UnitTests\System.Windows.Forms.Tests.csproj...
2018-12-30T00:24:52.0521608Z   Restoring packages for F:\vsagent\68\s\src\System.Windows.Forms\tests\functests\WinformsControlsTest\WinformsControlsTest.csproj...
2018-12-30T00:24:53.7256945Z   Installing runtime.win-x64.Microsoft.NETCore.DotNetAppHost 3.0.0-preview-27205-02.
2018-12-30T00:24:53.9554384Z   Installing runtime.win-x64.Microsoft.NETCore.DotNetHostResolver 3.0.0-preview-27205-02.
2018-12-30T00:24:53.9555400Z   Installing runtime.win-x64.Microsoft.NETCore.DotNetHostPolicy 3.0.0-preview-27205-02.
2018-12-30T00:24:53.9623163Z   Installing runtime.win-x64.Microsoft.NETCore.App 3.0.0-preview-27205-02.
2018-12-30T00:24:54.0483211Z   Installing System.Xml.XmlSerializer 4.0.11.
2018-12-30T00:24:54.0736915Z   Installing System.Security.Cryptography.Csp 4.0.0.
2018-12-30T00:24:54.1303927Z   Installing System.Security.Cryptography.Cng 4.2.0.
2018-12-30T00:24:54.1394580Z   Installing System.Security.Cryptography.OpenSsl 4.0.0.
2018-12-30T00:24:54.1394995Z   Installing System.Diagnostics.DiagnosticSource 4.0.0.
2018-12-30T00:24:54.1492397Z   Installing System.Globalization.Extensions 4.0.1.
2018-12-30T00:24:54.1492673Z   Installing runtime.native.System.Security.Cryptography 4.0.0.
2018-12-30T00:24:54.1492890Z   Installing runtime.native.System.Net.Http 4.0.1.
2018-12-30T00:24:54.1493080Z   Installing System.Buffers 4.0.0.
2018-12-30T00:24:54.1493272Z   Installing runtime.native.System.IO.Compression 4.1.0.
2018-12-30T00:24:54.1493486Z   Installing System.Private.DataContractSerialization 4.1.1.
2018-12-30T00:24:54.1493696Z   Installing System.Collections.Immutable 1.2.0.
2018-12-30T00:24:54.1493875Z   Installing System.Xml.XPath 4.0.1.
2018-12-30T00:24:54.1494094Z   Installing System.Xml.XmlDocument 4.0.1.
2018-12-30T00:24:54.1494408Z   Installing System.Threading.ThreadPool 4.0.10.
2018-12-30T00:24:54.1494616Z   Installing Microsoft.Win32.Registry 4.0.0.
2018-12-30T00:24:54.7748313Z   Installing runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple 4.3.0.
2018-12-30T00:24:54.7749319Z   Installing runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
2018-12-30T00:24:54.9185072Z   Installing runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
2018-12-30T00:24:54.9216214Z   Installing runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
2018-12-30T00:24:54.9661842Z   Installing runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
2018-12-30T00:24:55.0113020Z   Installing runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
2018-12-30T00:24:55.0113681Z   Installing runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
2018-12-30T00:24:55.0279197Z   Installing runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
2018-12-30T00:24:55.0279531Z   Installing xunit 2.4.1-pre.build.4059.
2018-12-30T00:24:55.0279790Z   Installing xunit.runner.visualstudio 2.4.1-pre.build.4059.
2018-12-30T00:24:55.0280102Z   Installing runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
2018-12-30T00:24:55.0280339Z   Installing runtime.native.System 4.0.0.
2018-12-30T00:24:55.0280583Z   Installing runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
2018-12-30T00:24:55.0280820Z   Installing System.ComponentModel 4.0.1.
2018-12-30T00:24:55.0281185Z   Installing runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
2018-12-30T00:24:55.0281532Z   Installing Xunit.StaFact 0.3.5.
2018-12-30T00:24:55.7032813Z   Installing xunit.runner.console 2.4.1-pre.build.4059.
2018-12-30T00:24:56.1901726Z   Installing Microsoft.NET.Test.Sdk 15.9.0.
2018-12-30T00:24:56.2156567Z   Installing Moq 4.10.0.
2018-12-30T00:24:56.2428154Z   Installing xunit.core 2.4.1-pre.build.4059.
2018-12-30T00:24:56.2432009Z   Installing xunit.assert 2.4.1-pre.build.4059.
2018-12-30T00:24:56.2434199Z   Installing xunit.analyzers 0.10.0.
2018-12-30T00:24:56.2502976Z   Installing System.Collections.NonGeneric 4.0.1.
2018-12-30T00:24:56.2503554Z   Installing Microsoft.CodeCoverage 15.9.0.
2018-12-30T00:24:56.2503962Z   Installing xunit.extensibility.execution 2.4.0.
2018-12-30T00:24:56.2504334Z   Installing Microsoft.TestPlatform.TestHost 15.9.0.
2018-12-30T00:24:56.2504726Z   Installing System.ValueTuple 4.4.0.
2018-12-30T00:25:00.6834668Z   Installing xunit.extensibility.core 2.4.1-pre.build.4059.
2018-12-30T00:25:01.1382382Z   Installing xunit.extensibility.execution 2.4.1-pre.build.4059.
2018-12-30T00:25:01.1382930Z   Installing Newtonsoft.Json 9.0.1.
2018-12-30T00:25:01.2615517Z   Installing System.Threading.Tasks.Extensions 4.3.0.
2018-12-30T00:25:01.4550235Z   Installing System.Reflection.TypeExtensions 4.3.0.
2018-12-30T00:25:01.7215837Z   Installing System.Reflection.Emit 4.3.0.
2018-12-30T00:25:01.7216387Z   Installing Castle.Core 4.3.1.
2018-12-30T00:25:01.7613458Z   Installing Microsoft.Extensions.DependencyModel 1.0.3.
2018-12-30T00:25:01.8714965Z   Installing System.ComponentModel.Primitives 4.1.0.
2018-12-30T00:25:01.9415318Z   Installing Microsoft.TestPlatform.ObjectModel 15.9.0.
2018-12-30T00:25:01.9979565Z   Installing System.Linq.Queryable 4.3.0.
2018-12-30T00:25:02.0748776Z   Installing NETStandard.Library 1.6.1.
2018-12-30T00:25:02.0749357Z   Installing xunit.extensibility.core 2.4.0.
2018-12-30T00:25:02.0752474Z   Installing xunit.abstractions 2.0.3.
2018-12-30T00:25:02.0752809Z   Installing xunit.abstractions 2.0.2.
2018-12-30T00:25:02.0753826Z   Installing System.Collections 4.3.0.
2018-12-30T00:25:02.0754114Z   Installing System.Collections 4.0.11.
2018-12-30T00:25:02.0755077Z   Installing System.Runtime 4.3.0.
2018-12-30T00:25:02.0755350Z   Installing System.Threading.Tasks 4.3.0.
2018-12-30T00:25:02.0756117Z   Installing System.Diagnostics.Debug 4.0.11.
2018-12-30T00:25:02.0756379Z   Installing System.Globalization 4.0.11.
2018-12-30T00:25:02.0757214Z   Installing System.Reflection 4.3.0.
2018-12-30T00:25:02.0757506Z   Installing System.IO 4.1.0.
2018-12-30T00:25:04.8566967Z   Installing System.Linq 4.1.0.
2018-12-30T00:25:04.9355838Z   Installing System.Reflection.Primitives 4.3.0.
2018-12-30T00:25:05.0251950Z   Installing System.Linq.Expressions 4.1.0.
2018-12-30T00:25:05.0751223Z   Installing System.IO 4.3.0.
2018-12-30T00:25:05.1497297Z   Installing System.Collections.Specialized 4.0.1.
2018-12-30T00:25:05.4110437Z   Installing System.Reflection.Emit.ILGeneration 4.3.0.
2018-12-30T00:25:05.6130280Z   Installing System.ObjectModel 4.0.12.
2018-12-30T00:25:05.7625777Z   Installing System.Reflection 4.1.0.
2018-12-30T00:25:05.9129656Z   Installing System.ComponentModel 4.3.0.
2018-12-30T00:25:05.9212424Z   Installing System.Reflection.Extensions 4.0.1.
2018-12-30T00:25:05.9212671Z   Installing System.ComponentModel.TypeConverter 4.3.0.
2018-12-30T00:25:05.9212880Z   Installing System.Collections.Specialized 4.3.0.
2018-12-30T00:25:05.9213072Z   Installing System.Diagnostics.TraceSource 4.3.0.
2018-12-30T00:25:05.9213407Z   Installing System.Xml.XmlDocument 4.3.0.
2018-12-30T00:25:05.9213613Z   Installing System.Dynamic.Runtime 4.3.0.
2018-12-30T00:25:05.9213824Z   Installing System.Resources.ResourceManager 4.0.1.
2018-12-30T00:25:05.9214130Z   Installing System.Diagnostics.Debug 4.3.0.
2018-12-30T00:25:05.9214334Z   Installing System.Runtime 4.1.0.
2018-12-30T00:25:05.9214550Z   Installing System.Runtime.Extensions 4.1.0.
2018-12-30T00:25:05.9214781Z   Installing System.Runtime.Serialization.Primitives 4.1.1.
2018-12-30T00:25:05.9214996Z   Installing System.Resources.ResourceManager 4.3.0.
2018-12-30T00:25:05.9215219Z   Installing System.Reflection.Extensions 4.3.0.
2018-12-30T00:25:05.9216211Z   Installing System.Linq 4.3.0.
2018-12-30T00:25:05.9216515Z   Installing System.Linq.Expressions 4.3.0.
2018-12-30T00:25:05.9216724Z   Installing Microsoft.NETCore.Platforms 1.1.0.
2018-12-30T00:25:05.9216921Z   Installing System.AppContext 4.3.0.
2018-12-30T00:25:05.9217405Z   Installing System.Text.Encoding 4.0.11.
2018-12-30T00:25:05.9217600Z   Installing System.Text.Encoding.Extensions 4.0.11.
2018-12-30T00:25:05.9217800Z   Installing Microsoft.Win32.Primitives 4.3.0.
2018-12-30T00:25:05.9218000Z   Installing System.Text.RegularExpressions 4.1.0.
2018-12-30T00:25:09.2135002Z   Installing System.Collections.Concurrent 4.3.0.
2018-12-30T00:25:09.2136193Z   Installing System.Threading 4.0.11.
2018-12-30T00:25:09.2790330Z   Installing System.Threading.Timer 4.3.0.
2018-12-30T00:25:09.2791017Z   Installing System.Threading 4.3.0.
2018-12-30T00:25:09.2791293Z   Installing System.Threading.Tasks 4.0.11.
2018-12-30T00:25:09.3381653Z   Installing System.Diagnostics.Tracing 4.3.0.
2018-12-30T00:25:09.5081755Z   Installing System.Net.Primitives 4.3.0.
2018-12-30T00:25:11.7312432Z   Installing System.Globalization 4.3.0.
2018-12-30T00:25:11.7545109Z   Installing System.Diagnostics.Tools 4.3.0.
2018-12-30T00:25:12.0130985Z   Installing System.Security.Cryptography.X509Certificates 4.1.0.
2018-12-30T00:25:12.0580350Z   Installing System.Xml.ReaderWriter 4.0.11.
2018-12-30T00:25:12.1425257Z   Installing System.Xml.XDocument 4.0.11.
2018-12-30T00:25:12.2078537Z   Installing Microsoft.CSharp 4.0.1.
2018-12-30T00:25:12.2709266Z   Installing System.Dynamic.Runtime 4.0.11.
2018-12-30T00:25:12.3246861Z   Installing Microsoft.DotNet.PlatformAbstractions 1.0.3.
2018-12-30T00:25:12.4119065Z   Installing System.Console 4.3.0.
2018-12-30T00:25:12.4424939Z   Installing System.IO.FileSystem 4.3.0.
2018-12-30T00:25:12.5328619Z   Installing System.IO.FileSystem.Primitives 4.3.0.
2018-12-30T00:25:12.6801424Z   Installing NETStandard.Library 1.6.0.
2018-12-30T00:25:12.7722657Z   Installing System.Reflection.TypeExtensions 4.1.0.
2018-12-30T00:25:12.7723148Z   Installing System.ComponentModel.TypeConverter 4.1.0.
2018-12-30T00:25:12.9037523Z   Installing System.Globalization.Calendars 4.3.0.
2018-12-30T00:25:12.9037911Z   Installing System.ComponentModel.EventBasedAsync 4.0.11.
2018-12-30T00:25:12.9038142Z   Installing System.Net.Sockets 4.3.0.
2018-12-30T00:25:12.9038337Z   Installing System.Runtime.Numerics 4.3.0.
2018-12-30T00:25:16.2148748Z   Installing System.Runtime.InteropServices.RuntimeInformation 4.0.0.
2018-12-30T00:25:16.3279660Z   Installing System.ObjectModel 4.3.0.
2018-12-30T00:25:16.3710247Z   Installing System.Runtime.InteropServices.RuntimeInformation 4.3.0.
2018-12-30T00:25:16.4771882Z   Installing System.Text.Encoding.Extensions 4.3.0.
2018-12-30T00:25:16.4772690Z   Installing System.Text.Encoding 4.3.0.
2018-12-30T00:25:16.5207071Z   Installing System.Text.RegularExpressions 4.3.0.
2018-12-30T00:25:16.5839206Z   Installing System.IO.Compression.ZipFile 4.3.0.
2018-12-30T00:25:16.6718055Z   Installing System.Runtime.Loader 4.0.0.
2018-12-30T00:25:16.6967388Z   Installing System.Runtime.Handles 4.3.0.
2018-12-30T00:25:16.8184447Z   Installing System.Runtime.Handles 4.0.1.
2018-12-30T00:25:16.8680687Z   Installing System.Threading.Thread 4.0.0.
2018-12-30T00:25:16.8840308Z   Installing System.Diagnostics.TextWriterTraceListener 4.0.0.
2018-12-30T00:25:16.9307642Z   Installing System.Security.Cryptography.Primitives 4.3.0.
2018-12-30T00:25:16.9324086Z   Installing System.Diagnostics.TraceSource 4.0.0.
2018-12-30T00:25:17.0531486Z   Installing System.Diagnostics.Process 4.1.0.
2018-12-30T00:25:17.1006431Z   Installing System.Xml.ReaderWriter 4.3.0.
2018-12-30T00:25:17.1098019Z   Installing System.Xml.XPath.XmlDocument 4.0.1.
2018-12-30T00:25:17.1098529Z   Installing System.Reflection.Metadata 1.3.0.
2018-12-30T00:25:17.1114856Z   Installing System.Xml.XDocument 4.3.0.
2018-12-30T00:25:19.9072936Z   Installing System.Runtime.Serialization.Json 4.0.2.
2018-12-30T00:25:20.0775922Z   Installing System.IO.Compression 4.3.0.
2018-12-30T00:25:20.1740055Z   Installing System.Runtime.Extensions 4.3.0.
2018-12-30T00:25:20.2500052Z   Installing System.Runtime.InteropServices 4.3.0.
2018-12-30T00:25:20.2500618Z   Installing Microsoft.NETCore.Platforms 1.0.1.
2018-12-30T00:25:20.2604933Z   Installing Microsoft.NETCore.Targets 1.0.1.
2018-12-30T00:25:20.2605215Z   Installing System.Reflection.Emit 4.0.1.
2018-12-30T00:25:20.2605457Z   Installing System.Reflection.Emit.ILGeneration 4.0.1.
2018-12-30T00:25:20.2605706Z   Installing System.Reflection.Emit.Lightweight 4.0.1.
2018-12-30T00:25:20.2605945Z   Installing System.Reflection.Primitives 4.0.1.
2018-12-30T00:25:20.2606152Z   Installing System.IO.FileSystem 4.0.1.
2018-12-30T00:25:20.2606386Z   Installing System.IO.FileSystem.Primitives 4.0.1.
2018-12-30T00:25:20.2606624Z   Installing System.Runtime.InteropServices 4.1.0.
2018-12-30T00:25:20.2606827Z   Installing System.Net.Http 4.3.0.
2018-12-30T00:25:20.2607205Z   Installing System.Security.Cryptography.Encoding 4.3.0.
2018-12-30T00:25:21.3431050Z   Installing System.Threading.Timer 4.0.1.
2018-12-30T00:25:21.3858969Z   Installing System.Threading.Tasks.Extensions 4.0.0.
2018-12-30T00:25:21.4608456Z   Installing System.Security.Cryptography.X509Certificates 4.3.0.
2018-12-30T00:25:21.5002762Z   Installing System.Security.Cryptography.Algorithms 4.3.0.
2018-12-30T00:25:21.6390312Z   Installing System.Diagnostics.Tools 4.0.1.
2018-12-30T00:25:21.7003605Z   Installing System.AppContext 4.1.0.
2018-12-30T00:25:21.7381934Z   Installing Microsoft.Win32.Primitives 4.0.1.
2018-12-30T00:25:21.8495928Z   Installing System.Collections.Concurrent 4.0.12.
2018-12-30T00:25:21.9220864Z   Installing System.Console 4.0.0.
2018-12-30T00:25:21.9722875Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\WinformsControlsTest\WinformsControlsTest.csproj.nuget.g.props.
2018-12-30T00:25:21.9843667Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\WinformsControlsTest\WinformsControlsTest.csproj.nuget.g.targets.
2018-12-30T00:25:22.0371947Z   Installing System.Diagnostics.Tracing 4.1.0.
2018-12-30T00:25:22.9529056Z   Restore completed in 29.02 sec for F:\vsagent\68\s\src\System.Windows.Forms\tests\functests\WinformsControlsTest\WinformsControlsTest.csproj.
2018-12-30T00:25:22.9774031Z   Installing System.Globalization.Calendars 4.0.1.
2018-12-30T00:25:23.0847378Z   Installing System.IO.Compression 4.1.0.
2018-12-30T00:25:23.1228110Z   Installing System.IO.Compression.ZipFile 4.0.1.
2018-12-30T00:25:23.1989600Z   Installing System.Net.Http 4.1.0.
2018-12-30T00:25:23.2519096Z   Installing Microsoft.NETCore.Targets 1.1.0.
2018-12-30T00:25:23.3355129Z   Installing System.ComponentModel.Primitives 4.3.0.
2018-12-30T00:25:23.3714693Z   Installing System.Net.Primitives 4.0.11.
2018-12-30T00:25:23.4205053Z   Installing System.Net.Sockets 4.1.0.
2018-12-30T00:25:23.4568874Z   Installing System.Collections.NonGeneric 4.3.0.
2018-12-30T00:25:23.4749661Z   Installing System.Runtime.Numerics 4.0.1.
2018-12-30T00:25:23.6065849Z   Installing runtime.native.System 4.3.0.
2018-12-30T00:25:23.8281409Z   Installing System.Globalization.Extensions 4.3.0.
2018-12-30T00:25:23.8400370Z   Installing System.Reflection.Emit.Lightweight 4.3.0.
2018-12-30T00:25:23.8400905Z   Installing System.Security.Cryptography.Algorithms 4.2.0.
2018-12-30T00:25:23.8415064Z   Installing System.Security.Cryptography.Encoding 4.0.0.
2018-12-30T00:25:26.7099877Z   Installing System.Buffers 4.3.0.
2018-12-30T00:25:26.7270004Z   Installing runtime.native.System.IO.Compression 4.3.0.
2018-12-30T00:25:26.8454434Z   Installing System.Security.Cryptography.Primitives 4.0.0.
2018-12-30T00:25:26.9147191Z   Installing System.Security.Cryptography.OpenSsl 4.3.0.
2018-12-30T00:25:26.9263651Z   Installing System.Diagnostics.DiagnosticSource 4.3.0.
2018-12-30T00:25:26.9862077Z   Installing runtime.native.System.Net.Http 4.3.0.
2018-12-30T00:25:27.0709345Z   Installing runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
2018-12-30T00:25:27.1242350Z   Installing System.Security.Cryptography.Cng 4.3.0.
2018-12-30T00:25:27.2952289Z   Installing System.Security.Cryptography.Csp 4.3.0.
2018-12-30T00:25:27.3678465Z   Installing runtime.native.System.Security.Cryptography.Apple 4.3.0.
2018-12-30T00:25:30.0208187Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Windows.Forms.Design.Editors.Tests\System.Windows.Forms.Design.Editors.Tests.csproj.nuget.g.props.
2018-12-30T00:25:30.0218379Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Windows.Forms.Design.Tests\System.Windows.Forms.Design.Tests.csproj.nuget.g.props.
2018-12-30T00:25:30.0226303Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Windows.Forms.Design.Editors.Tests\System.Windows.Forms.Design.Editors.Tests.csproj.nuget.g.targets.
2018-12-30T00:25:30.0320571Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Windows.Forms.Design.Tests\System.Windows.Forms.Design.Tests.csproj.nuget.g.targets.
2018-12-30T00:25:30.0879741Z   Restore completed in 38.14 sec for F:\vsagent\68\s\src\System.Windows.Forms.Design.Editors\tests\UnitTests\System.Windows.Forms.Design.Editors.Tests.csproj.
2018-12-30T00:25:30.0933462Z   Restore completed in 38.07 sec for F:\vsagent\68\s\src\System.Windows.Forms.Design\tests\System.Windows.Forms.Design.Tests.csproj.
2018-12-30T00:25:30.4995637Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Windows.Forms.Tests\System.Windows.Forms.Tests.csproj.nuget.g.props.
2018-12-30T00:25:30.5084627Z   Generating MSBuild file F:\vsagent\68\s\artifacts\obj\System.Windows.Forms.Tests\System.Windows.Forms.Tests.csproj.nuget.g.targets.
2018-12-30T00:25:30.5612522Z   Restore completed in 38.46 sec for F:\vsagent\68\s\src\System.Windows.Forms\tests\UnitTests\System.Windows.Forms.Tests.csproj.
2018-12-30T00:25:37.9287678Z   System.Windows.Forms.Ref -> F:\vsagent\68\s\artifacts\bin\System.Windows.Forms.Ref\Debug\netcoreapp3.0\System.Windows.Forms.dll
2018-12-30T00:25:40.2181755Z   System.Windows.Forms.Design.Editors.Ref -> F:\vsagent\68\s\artifacts\bin\System.Windows.Forms.Design.Editors.Ref\Debug\netcoreapp3.0\System.Windows.Forms.Design.Editors.dll
2018-12-30T00:25:40.3101221Z   System.Windows.Forms.Design.Ref -> F:\vsagent\68\s\artifacts\bin\System.Windows.Forms.Design.Ref\Debug\netcoreapp3.0\System.Windows.Forms.Design.dll
2018-12-30T00:25:49.0844315Z   System.Design.Facade -> F:\vsagent\68\s\artifacts\bin\System.Design.Facade\Debug\netcoreapp3.0\System.Design.dll
2018-12-30T00:25:49.2986312Z   System.Drawing.Design.Facade -> F:\vsagent\68\s\artifacts\bin\System.Drawing.Design.Facade\Debug\netcoreapp3.0\System.Drawing.Design.dll
2018-12-30T00:25:52.5754735Z   System.Windows.Forms -> F:\vsagent\68\s\artifacts\bin\System.Windows.Forms\Debug\netcoreapp3.0\System.Windows.Forms.dll
2018-12-30T00:25:55.2151910Z   System.Windows.Forms.Design -> F:\vsagent\68\s\artifacts\bin\System.Windows.Forms.Design\Debug\netcoreapp3.0\System.Windows.Forms.Design.dll
2018-12-30T00:25:57.2579210Z   System.Windows.Forms.Tests -> F:\vsagent\68\s\artifacts\bin\System.Windows.Forms.Tests\Debug\netcoreapp3.0\System.Windows.Forms.Tests.dll
2018-12-30T00:25:57.7657703Z   System.Windows.Forms.Design.Editors -> F:\vsagent\68\s\artifacts\bin\System.Windows.Forms.Design.Editors\Debug\netcoreapp3.0\System.Windows.Forms.Design.Editors.dll
2018-12-30T00:25:59.5406809Z   WinformsControlsTest -> F:\vsagent\68\s\artifacts\bin\WinformsControlsTest\Debug\netcoreapp3.0\WinformsControlsTest.dll
2018-12-30T00:26:00.5056608Z   Microsoft.Private.Winforms -> F:\vsagent\68\s\artifacts\bin\Microsoft.Private.Winforms\Debug\netcoreapp3.0\Microsoft.Private.Winforms.dll
2018-12-30T00:26:00.6186855Z   System.Windows.Forms.Design.Editors.Tests -> F:\vsagent\68\s\artifacts\bin\System.Windows.Forms.Design.Editors.Tests\Debug\netcoreapp3.0\System.Windows.Forms.Design.Editors.Tests.dll
2018-12-30T00:26:01.2253006Z   System.Windows.Forms.Design.Tests -> F:\vsagent\68\s\artifacts\bin\System.Windows.Forms.Design.Tests\Debug\netcoreapp3.0\System.Windows.Forms.Design.Tests.dll
2018-12-30T00:26:01.7953336Z   Running tests: F:\vsagent\68\s\artifacts\bin\System.Windows.Forms.Design.Editors.Tests\Debug\netcoreapp3.0\System.Windows.Forms.Design.Editors.Tests.dll [netcoreapp3.0|x64]
2018-12-30T00:26:01.7961152Z   Running tests: F:\vsagent\68\s\artifacts\bin\System.Windows.Forms.Tests\Debug\netcoreapp3.0\System.Windows.Forms.Tests.dll [netcoreapp3.0|x64]
2018-12-30T00:26:02.7055374Z   Tests succeeded: F:\vsagent\68\s\artifacts\bin\System.Windows.Forms.Design.Editors.Tests\Debug\netcoreapp3.0\System.Windows.Forms.Design.Editors.Tests.dll [netcoreapp3.0|x64]
2018-12-30T00:26:02.9370821Z   Running tests: F:\vsagent\68\s\artifacts\bin\System.Windows.Forms.Design.Tests\Debug\netcoreapp3.0\System.Windows.Forms.Design.Tests.dll [netcoreapp3.0|x64]
2018-12-30T00:26:03.2815779Z XUnit : error : Tests failed: F:\vsagent\68\s\artifacts\log\Debug\System.Windows.Forms.Tests_netcoreapp3.0_x64.log [netcoreapp3.0|x64] [F:\vsagent\68\s\src\System.Windows.Forms\tests\UnitTests\System.Windows.Forms.Tests.csproj]
2018-12-30T00:26:04.5205385Z   Tests succeeded: F:\vsagent\68\s\artifacts\bin\System.Windows.Forms.Design.Tests\Debug\netcoreapp3.0\System.Windows.Forms.Design.Tests.dll [netcoreapp3.0|x64]
2018-12-30T00:26:04.9253866Z 
2018-12-30T00:26:04.9432462Z Build FAILED.
2018-12-30T00:26:04.9432790Z 
2018-12-30T00:26:04.9591796Z XUnit : error : Tests failed: F:\vsagent\68\s\artifacts\log\Debug\System.Windows.Forms.Tests_netcoreapp3.0_x64.log [netcoreapp3.0|x64] [F:\vsagent\68\s\src\System.Windows.Forms\tests\UnitTests\System.Windows.Forms.Tests.csproj]
2018-12-30T00:26:04.9592565Z     0 Warning(s)
2018-12-30T00:26:04.9592914Z     1 Error(s)
2018-12-30T00:26:04.9593171Z 
2018-12-30T00:26:04.9593579Z Time Elapsed 00:01:25.50
2018-12-30T00:26:05.0538074Z Build failed.
2018-12-30T00:26:05.0618424Z See log: F:\vsagent\68\s\artifacts\log\Debug\Build.binlog
2018-12-30T00:26:05.0681401Z Killing running build processes...
2018-12-30T00:26:05.2443878Z ##[error]Cmd.exe exited with code '1'.
2018-12-30T00:26:05.3264632Z ##[section]Finishing: Windows Build / Publish

test-bug

Most helpful comment

First let me say that I know I'm in the minority with this opinion. Engineers tend to value performance over everything else, but I do not. :)

I get that Debug.Assert is better performance than throwing exceptions. My argument is that it's safer for every method (even privates) to just validate its own arguments with exceptions. This guarantees that the inputs are valid for any method, regardless of the call stack, regardless of the config.

I understand that means you are often validating the same argument multiple times, which is why people prefer Debug.Assert. But I prefer a safe (and properly unit testable) method over a little performance gain.

What if someone else (another dev) sees this private method and uses it, but doesn't realize they have to validate the args before passing them down? I would rather eliminate this possibility entirely and make my method bulletproof.

Again, I know this is not a popular opinion, but I've been burned too many times by methods not validating their own args. In my experience, the performance cost of a couple IF statements is worth the "stronger" code.

All 20 comments

In this case, do you know which debug assert failed?

I agree this kind of thing should show up in the build as a debug assertion failure, not a test failure.

Debug asserts happen at runtime, not compile time. If the DEBUG tests are running, debug asserts will be hit I think.


From: Zachary Danz notifications@github.com
Sent: Friday, January 4, 2019 3:10 PM
To: dotnet/winforms
Cc: Subscribed
Subject: Re: [dotnet/winforms] Debug.Assert failures don't appear in the CI (#277)

I agree this kind of thing should show up in the build as a debug assertion failure, not a test failure.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdotnet%2Fwinforms%2Fissues%2F277%23issuecomment-451569415&data=02%7C01%7CAdam.Yoblick%40microsoft.com%7Cd27ff12fadf641bf3fa708d672890deb%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636822330301724904&sdata=shl5guCm9B%2BKuoUEg1cpJEMwtwKBQ3WQa6nQi8%2FCIfE%3D&reserved=0, or mute the threadhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAcEqjR_MyN_yedxnB6fuPAYaGNu8eFCWks5u_8NEgaJpZM4ZlGsa&data=02%7C01%7CAdam.Yoblick%40microsoft.com%7Cd27ff12fadf641bf3fa708d672890deb%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636822330301724904&sdata=EW5V1DfXjQxZWxy4ftfqs%2FzjcoMjf3T55oCAOfO%2Bjdk%3D&reserved=0.

Debug assertions need a trace listener to work well in automated test scenarios. For example, see PerfView's use of ThrowingTraceListener. Note that the listener requires registration to work, which can be seen in https://github.com/Microsoft/perfview/commit/b846e8d0dc4dd3ca95061ad4adc3d309eaa88bb8. Adjustments may be required since that example runs on .NET Framework.

This is why I'm not a fan of Debug.Asserts in general. I get that they improve performance in release scenarios, but I would rather the test fail consistently if it's supposed to, in both debug and release.

@AdamYoblick you are missing the point, this was a DEBUG run (see -configuration Debug switch in the log)

The point sharwell raises is that for CI you need some additional setup code to have Debug.Assert/Trace.Assert actually be treated as a test failure.

I understand what Sam is saying. :) This means we would need to change our test code based on the config being run, which I'm not a fan of. If my team disagrees, then I'm flexible of course.

In my opinion, all methods should use real error handling (i.e. throwing exceptions) instead of Debug.Asserts. This would eliminate the need for special test code for the debug config.

I understand the performance implications of this, which is why many people prefer to use Debug.Assert, especially in private methods (but we don't test private methods directly anyway)

@AdamYoblick Debug.Assert can be helpful for things like internal invariants that should never be violated. For example, a private method could assert arguments are not null if both 1) all exposed callers validate arguments and 2) it's not immediately obvious from the code flow that the callers ensure the arguments are not null. In such a case, Debug.Assert is preferable to argument checking because the resulting IL is smaller/more efficient, without any actual change to behavior of the production code.

In some cases, Debug.Assert can be used in place of plain comments in code that make a statement regarding the state of one or more variables at a particular location in an algorithm. The assertions are not intended to change behavior, but rather document it. They offer an advantage over plain comments because they will call attention to themselves should the conditions ever change in the future.

In general, the assertions should not impact the test code.

First let me say that I know I'm in the minority with this opinion. Engineers tend to value performance over everything else, but I do not. :)

I get that Debug.Assert is better performance than throwing exceptions. My argument is that it's safer for every method (even privates) to just validate its own arguments with exceptions. This guarantees that the inputs are valid for any method, regardless of the call stack, regardless of the config.

I understand that means you are often validating the same argument multiple times, which is why people prefer Debug.Assert. But I prefer a safe (and properly unit testable) method over a little performance gain.

What if someone else (another dev) sees this private method and uses it, but doesn't realize they have to validate the args before passing them down? I would rather eliminate this possibility entirely and make my method bulletproof.

Again, I know this is not a popular opinion, but I've been burned too many times by methods not validating their own args. In my experience, the performance cost of a couple IF statements is worth the "stronger" code.

I agree with @AdamYoblick that runtime checks are in 99.9% cases better than Debug.Assert. Only 0.1% code may be so perf sensitive, that it matters and justifies use of Debug.Assert. Rather be sure (while a bit slower) than faster and sorry.
@stephentoub @danmosemsft does it match your guidence and experience in CoreFX?

I'm having trouble following the discussion. Can someone help me understand what the original problem is? By default a Debug.Assert will fail fast; is that not happening? Has it been overridden? Etc.

As for guidance, my view of Debug.Assert is basically the same as @sharwell: it's for validating that internal invariants aren't broken. In some cases, those internal invariants are for internal argument validation, and the lower you get in the stack, the more important it is not to keep paying for argument validation costs over and over and over, so while it might behoove a higher-level library to validate arguments with runtime checks and exceptions at every level of the stack, that's not the case for lower level libraries, like most of the ones in coreclr/corefx, so there it's common to see asserts used in internal/private helpers to sanity check that the inputs we're getting are what we expected.

@stephentoub In a nutshell, the suggestion was that Debug.Asserts should properly fail our unit tests. Sam mentioned that we could modify our test code to subscribe to a trace listener in order for debug asserts to properly fail unit tests when running against a debug config.

My comment was we should not have to do this. If a test case is supposed to fail, it should be using Assert.Throws and should be catching a real exception, not a debug assert.

Thanks for summarizing.

My comment was we should not have to do this.

If the tests in question are validating public surface area, then from my perspective no Debug.Assert should ever be triggerable. In such a case, there's a bad bug, either the assert itself is bad or the important invariant its validating isn't being held, and it fail fasts; this isn't something to be validating via Assert.Throws because you should never be able to cause such errors to happen via the public surface area.

However, I remember earlier discussions that were advocating for being able to use InternalsVisibleTo to unit test via internals rather than publics. If these asserts are triggering because of misuse at that level, I have no sympathy ;-)

I think the consensus is that we don't want Debug.Asserts to fail our CI builds.

I would urge you to reconsider this issue. Debug assertions don’t even appear in the continuous integration, they simply fail. This issue isn’t about the merits or demerits or debug assertions but more that if a debug assert it hit in ci, it says “tests failed” but the tests succeeded percent is 100% and the stack trace is missing.

By fail I mean the test run crashes

Ohh I see, I was under the impression that debug asserts didn’t fail the CI build. You’re saying they do in a weird way.

In my opinion, that means we should either get rid of all the debug asserts (since many are informational), or only run unit tests for the release config.

Or the third option what is what Sam suggested, which is add a trace listener for the debug asserts.

My understanding of what @stephentoub suggested above is:

  • Debug asserts are useful
  • When Debug assert fails, it should show up as test failure (i.e. "fail" CI build)

@merriemcgaw Reopening this because we misunderstood what was happening. This does currently affect the CI build.

I think I'm leaning towards @Shyam-Gupta 's suggestion of only running unit tests for the release config (since this is what customers consume anyway). This would prevent "informational" debug asserts from failing the CI build.

@dreddy-work @zsd4yr How do you feel about this?

Was this page helpful?
0 / 5 - 0 ratings