Hi @Nazar Demchyk ,
Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.
The error "Runtime instantiation of this attribute is not allowed" is a specific .NET runtime error. It typically occurs when an application running on .NET Core (or .NET 5/6/7/8) references a library built for .NET Framework that utilizes deprecated Code Access Security (CAS) attributes.
Potential Causes & Solutions:
- Package Version Mismatch: Ensure all your Azure DevOps related NuGet packages (e.g.,
Microsoft.TeamFoundationServer.Client,Microsoft.VisualStudio.Services.Client,Microsoft.VisualStudio.Services.TestManagement.TestPlanning.WebApi) are on the same version. Mixing versions can cause the loader to pull in an incorrect assembly target (e.g., a .NET Framework DLL instead of a .NET Standard one).- Action: Update all
Microsoft.VisualStudio.Services.*andMicrosoft.TeamFoundationServer.*packages to the latest stable version.
- Action: Update all
- Check the method signature in the assembly/package you referenced
- Verify with Intellisense or reflect on
GetTestSuitesForPlanAsyncto see whether theexpandparameter type isNullable<int>orNullable<SuiteExpand>. If it’sSuiteExpand?, pass aSuiteExpand?. If itsint?, cast the enum toint?. - Obsolete - TestCompatHttpClientBase.GetTestSuitesForPlanAsync Method
- Current - TestPlanHttpClientBase.GetTestSuitesForPlanAsync Method
- Verify with Intellisense or reflect on
Please let me know if above helps in comments.