{"record":{"id":"d8840b2bd5537724","repo":"dotnet/reactive","slug":"failed-to-find-targetframeworkattribute-on-rx-assembly","errorCode":null,"errorMessage":"Failed to find TargetFrameworkAttribute on Rx assembly","messagePattern":"Failed to find TargetFrameworkAttribute on Rx assembly","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"Rx.NET/Test/Gauntlet/Checks/PlugIns/PlugIn/PlugInEntryPoint.RxInfo.cs","lineNumber":18,"sourceCode":"﻿// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT License.\n// See the LICENSE file in the project root for more information. \n\nusing PlugIn.Api;\nusing System.Reflection;\nusing System.Reactive.Linq;\n\nnamespace PlugInTest;\n\n// Note: this file is compiled into all of the plug-ins:\n//  * the .NET 4.5 and .NET 4.6 plug-ins\n//  * all versions of Rx.NET\npublic partial class PlugInEntryPoint : IRxPlugInApi\n{\n    public string GetRxFullName() => typeof(Observable).Assembly.FullName ?? throw new InvalidOperationException(\"Failed to find Rx assembly\");\n    public string GetRxLocation() => typeof(Observable).Assembly.Location;\n    public string GetRxTargetFramework() => typeof(Observable).Assembly?.GetCustomAttribute<System.Runtime.Versioning.TargetFrameworkAttribute>()?.FrameworkName ?? throw new InvalidOperationException(\"Failed to find TargetFrameworkAttribute on Rx assembly\");\n}\n","sourceCodeStart":1,"sourceCodeEnd":20,"githubUrl":"https://github.com/dotnet/reactive/blob/94b5d5ab912789f5abe9a72138a25bbd716fe59c/Rx.NET/Test/Gauntlet/Checks/PlugIns/PlugIn/PlugInEntryPoint.RxInfo.cs#L1-L20","documentation":"The plug-in reads the TargetFrameworkAttribute from the loaded Rx assembly to report which TFM it targets; if the attribute is missing it throws InvalidOperationException 'Failed to find TargetFrameworkAttribute on Rx assembly'.","triggerScenarios":"The Rx assembly loaded in the plug-in has no TargetFrameworkAttribute — typically a non-SDK-style or manually processed build that didn't emit the attribute.","commonSituations":"Testing an old or locally rebuilt System.Reactive.dll lacking the attribute, using an assembly built with unusual build settings, or an IL-merged/trimmed Rx binary.","solutions":["Use an officially built Rx binary that carries the TargetFrameworkAttribute","Rebuild System.Reactive with the SDK generating assembly attributes (do not disable GenerateTargetFrameworkAttribute)","Check that the Gauntlet runtime is loading the intended Rx version, not a stale copy"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"var attr = typeof(Observable).Assembly.GetCustomAttribute<System.Runtime.Versioning.TargetFrameworkAttribute>();\nif (attr is null) throw new InvalidOperationException(\"Rx assembly lacks TargetFrameworkAttribute\");","typeGuard":null,"tryCatchPattern":"try { var tfm = entry.GetRxTargetFramework(); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"TargetFrameworkAttribute\")) { /* use a properly built Rx binary */ }","preventionTips":["Use NuGet-built Rx assemblies, not hand-modified ones","Don't strip assembly attributes in build/merge tooling","Verify with ildasm/asmpath that the attribute exists before Gauntlet runs"],"tags":["rx","test-infrastructure","assembly-attributes","gauntlet"],"backgroundTag":"missing-dependency","analyzedSha":"94b5d5ab912789f5abe9a72138a25bbd716fe59c","analyzedAt":"2026-09-15T02:26:24.759Z","contentChangedAt":"2026-09-15T02:26:24.759Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}