Skip to content

[Unhandled Exception]: VsTelemetryInitializer.Dispose(): System.NullReferenceException: Object reference not set to an instance of an object. #14484

Description

@kirillkovalenko

Issue Description

MSBuild version 18.8.2+ce25c0108 for .NET Framework crashes with NRE in telemetry classes.

Steps to Reproduce

nre-crash-msbulid-18.8.2.zip

Actual Behavior

MSBuild version 18.8.2+ce25c0108 for .NET Framework
Build started 22.07.2026 11:51:08.

[...]

MSBUILD : error MSB1025: An internal failure occurred while running MSBuild.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Build.Framework.Telemetry.VsTelemetryInitializer.Dispose()
   at Microsoft.Build.Framework.Telemetry.TelemetryManager.DisposeVsTelemetry()
   at Microsoft.Build.Framework.Telemetry.TelemetryManager.Dispose()
   at Microsoft.Build.Execution.BuildManager.Dispose(Boolean disposing)
   at Microsoft.Build.CommandLine.MSBuildApp.BuildProject(String projectFile, String[] targets, String toolsVersion, Dictionary`2 globalProperties, Dictionary`2 restoreProperties, ILogger[] loggers, LoggerVerbosity verbosity, DistributedLoggerRecord[] distributedLoggerRecords, Boolean needToValidateProject, String schemaFile, Int32 cpuCount, Boolean multiThreaded, Boolean enableNodeReuse, TextWriter preprocessWriter, TextWriter targetsWriter, Boolean detailedSummary, ISet`1 warningsAsErrors, ISet`1 warningsNotAsErrors, ISet`1 warningsAsMessages, Boolean enableRestore, ProfilerLogger profilerLogger, Boolean enableProfiler, Boolean interactive, ProjectIsolationMode isolateProjects, GraphBuildOptions graphBuildOptions, Boolean lowPriority, Boolean question, Boolean isTaskAndTargetItemLoggingRequired, Boolean isBuildCheckEnabled, String[] inputResultsCaches, String outputResultsCache, Boolean saveProjectResult, BuildResult& result, Boolean reportFileAccesses, String[] commandLine)
   at Microsoft.Build.CommandLine.MSBuildApp.Execute(String[] commandLine)
OnUnhandledException: Object reference not set to an instance of an object.
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Build.Framework.Telemetry.CrashTelemetryRecorder.PostFaultEvent(CrashTelemetry crashTelemetry)
   at Microsoft.Build.Framework.Telemetry.CrashTelemetryRecorder.RecordAndFlushCrashTelemetry(Exception exception, CrashExitType exitType, Boolean isUnhandled, Boolean isCritical)

Analysis

I've seen similar telemetry related crashes with earlier versions of VS 2026 and 2022, and the following environment used to help, but no longer:

DOTNET_CLI_TELEMETRY_OPTOUT: '1'
MSBUILDDISABLENODEREUSE: '1'
MSBuildTelemetryOptOut: 'true'
VCONE_TELEMETRY_OPTOUT: '1'
VS_TELEMETRY_OPT_OUT: '1' 
DISABLE_THREADED_REUSE: '1'

Versions & Configurations

Windows Server 2022
VS 2026 and VS2022 side by side
github actions runner

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions