You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Diagnostic UA0002 with the message This type is not supported on .NET Core/.NET 5+ and should be replaced with a modern equivalent. generated
And it is not clear, what type, why. I've scanned through migration guide and could not find anything related.
To Reproduce
Create new web project:
dotnet new web
and add class into Program.cs:
public class OverrideSuccessResponseCode : ResultFilterAttribute, IApiResponseMetadataProvider
{
public int StatusCode { get; }
public Type Type { get; } = typeof(void);
public OverrideSuccessResponseCode(int statusCode) => StatusCode = statusCode;
public override void OnResultExecuted(ResultExecutedContext context)
{
if (context.HttpContext.Response.StatusCode == (int)HttpStatusCode.OK)
{
context.HttpContext.Response.StatusCode = StatusCode;
}
}
void IApiResponseMetadataProvider.SetContentTypes(MediaTypeCollection contentTypes)
{
}
}
PS C:\temp\test-upgrade> upgrade-assistant.exe analyze .\test-upgrade.csproj
-----------------------------------------------------------------------------------------------------------------
Microsoft .NET Upgrade Assistant v0.3.310801+057ffba0656270dc5d83c015748ac56daed55886
We are interested in your feedback! Please use the following link to open a survey: https://aka.ms/DotNetUASurvey
-----------------------------------------------------------------------------------------------------------------
[08:26:03 INF] Loaded 6 extensions
[08:26:03 INF] Using MSBuild from C:\Program Files\dotnet\sdk\6.0.201\
[08:26:03 INF] Using Visual Studio install from C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional [v16]
[08:26:05 INF] Writing output to C:\temp\test-upgrade\AnalysisReport.sarif
[08:26:05 INF] Recommending executable TFM net6.0 because the project builds to an executable
[08:26:06 INF] Reference to .NET Upgrade Assistant analyzer package >(Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers, version 0.3.310801) needs to be added
[08:26:07 INF] Reference to Newtonsoft package (Microsoft.AspNetCore.Mvc.NewtonsoftJson, version 6.0.4) needs to be added
[08:26:07 INF] Running analyzers on test-upgrade
[08:26:08 INF] Identified 1 diagnostics in project test-upgrade
[08:26:08 INF] Diagnostic UA0002 with the message This type is not supported on .NET Core/.NET 5+ and should be replaced with a modern equivalent. generated
upgrade-asstant.clef file contains line:
{"@t":"2022-04-14T05:26:08.3477296Z","@mt":"Diagnostic {Id} with the message {Message} generated","Id":"UA0002","Message":"This type is not supported on .NET Core/.NET 5+ and should be replaced with a modern equivalent.","SourceContext":"Microsoft.DotNet.UpgradeAssistant.Steps.Source.DiagnosticAnalyzerResultProvider"}
AnalysisReport.sarif file contains:
{
"tool": {
"driver": {
"name": "API Upgradability",
"semanticVersion": "0.3.310801",
"informationUri": "https://docs.microsoft.com/en-us/dotnet/core/porting/upgrade-assistant-overview",
"rules": [
{
"id": "UA0002",
"fullDescription": {
"text": "Types should be upgraded"
},
"helpUri": "about:blank"
}
]
}
},
"results": [
{
"ruleId": "UA0002",
"message": {
"text": "This type is not supported on .NET Core/.NET 5+ and should be replaced with a modern equivalent."
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "file:///C:/temp/test-upgrade/Program.cs"
},
"region": {
"startLine": 20
}
}
}
]
}
],
"columnKind": "utf16CodeUnits"
}
From this information it is not clear what and how to fix.
Running assistant with upgrade command does not change source in any way.
The text was updated successfully, but these errors were encountered:
I'm also getting that error but only on VSCode, doesn't show on VS2022 (17.1.6)
I also tried using the dotnet upgrade-assistant and the *.sarif file generated points to the same issue. We're talking about plain old controllers and public methods being flagged with that warning
"ruleId": "UA0002", "message": { "text": "This type is not supported on .NET Core/.NET 5+ and should be replaced with a modern equivalent." }
any ideas of what this is about would be very appreciated.
* Display analyzer message in analysis reports rather than description
* Fix how packages are retrieved for non-SDK projects
* Fix package loader to check more thoroughly for TFM compatbility
Fixes#1102Fixes#1034
Describe the bug
When running upgrade assistant get following:
And it is not clear, what type, why. I've scanned through migration guide and could not find anything related.
To Reproduce
Create new web project:
and add class into Program.cs:
After running
You should get:
upgrade-asstant.clef file contains line:
AnalysisReport.sarif file contains:
From this information it is not clear what and how to fix.
Running assistant with upgrade command does not change source in any way.
The text was updated successfully, but these errors were encountered: