Open tportNAPA opened 4 years ago
Diagnostic timeout is separate thing of project load routines. Theres DocumentAnalysisTimeoutMs in omnisharp.json you can try configure but my bet is that it will timeout even if you add nearly infinite time for it (however thats something you can try).
There have been problems with certain analyzers with certain kind of files that caused them to hang in analysis. Problem is usually releated that theres something missing / differently configured than in visual studio workspaces. One of issues were fixed by https://github.com/OmniSharp/omnisharp-roslyn/pull/1566, however it seems there some left.
Things to debug:
Thank you for the response, I'll try to reproduce/debug in the near future when work allows.
Hi, we have a large code base 120 projects in a solution and we are experiencing this timeout on several large files. What information can we contribute to help work towards a solution?
Have this with some large files.
Is there a configurable timeout?
Happens to ms on Unity's Mathematics classes.
OmniSharp.Roslyn.CSharp.Services.Diagnostics.CSharpDiagnosticWorkerWithAnalyzers
Analysis of document float3x3.gen.cs failed or cancelled by timeout: The operation was canceled., analysers:
Microsoft.CodeAnalysis.UseSystemHashCode.UseSystemHashCodeDiagnosticAnalyzer,
Microsoft.CodeAnalysis.UseExplicitTupleName.UseExplicitTupleNameDiagnosticAnalyzer,
Microsoft.CodeAnalysis.MakeFieldReadonly.MakeFieldReadonlyDiagnosticAnalyzer,
Microsoft.CodeAnalysis.Formatting.FormattingDiagnosticAnalyzer,
Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.VSTypeScriptDocumentDiagnosticAnalyzer,
Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.VSTypeScriptProjectDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.ValidateFormatString.CSharpValidateFormatStringDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseThrowExpression.CSharpUseThrowExpressionDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseSimpleUsingStatement.UseSimpleUsingStatementDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseObjectInitializer.CSharpUseObjectInitializerDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseNullPropagation.CSharpUseNullPropagationDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseIsNullCheck.CSharpUseIsNullCheckForCastAndEqualityOperatorDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseIsNullCheck.CSharpUseIsNullCheckForReferenceEqualsDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseInferredMemberName.CSharpUseInferredMemberNameDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseIndexOrRangeOperator.CSharpUseIndexOperatorDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseIndexOrRangeOperator.CSharpUseRangeOperatorDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseImplicitObjectCreation.CSharpUseImplicitObjectCreationDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseCollectionInitializer.CSharpUseCollectionInitializerDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.RemoveUnusedParametersAndValues.CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.RemoveUnusedMembers.CSharpRemoveUnusedMembersDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryImports.CSharpRemoveUnnecessaryImportsDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryCast.CSharpRemoveUnnecessaryCastDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.QualifyMemberAccess.CSharpQualifyMemberAccessDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseDefaultLiteral.CSharpUseDefaultLiteralDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseDeconstruction.CSharpUseDeconstructionDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseConditionalExpression.CSharpUseConditionalExpressionForAssignmentDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseConditionalExpression.CSharpUseConditionalExpressionForReturnDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseCompoundAssignment.CSharpUseCompoundAssignmentDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseCompoundAssignment.CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseCoalesceExpression.CSharpUseCoalesceExpressionDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseCoalesceExpression.CSharpUseCoalesceExpressionForNullableDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.SimplifyLinqExpression.CSharpSimplifyLinqExpressionDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.SimplifyInterpolation.CSharpSimplifyInterpolationDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.SimplifyBooleanExpression.CSharpSimplifyConditionalDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.RemoveUnreachableCode.CSharpRemoveUnreachableCodeDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.PopulateSwitch.CSharpPopulateSwitchExpressionDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.PopulateSwitch.CSharpPopulateSwitchStatementDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.OrderModifiers.CSharpOrderModifiersDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.MisplacedUsingDirectives.MisplacedUsingDirectivesDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.MakeStructFieldsWritable.CSharpMakeStructFieldsWritableDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.InvokeDelegateWithConditionalAccess.InvokeDelegateWithConditionalAccessAnalyzer,
Microsoft.CodeAnalysis.CSharp.InlineDeclaration.CSharpInlineDeclarationDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.FileHeaders.CSharpFileHeaderDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.ConvertSwitchStatementToExpression.ConvertSwitchStatementToExpressionDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.ConvertAnonymousTypeToTuple.CSharpConvertAnonymousTypeToTupleDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.RemoveConfusingSuppression.CSharpRemoveConfusingSuppressionDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryParentheses.CSharpRemoveUnnecessaryPatternParenthesesDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryParentheses.CSharpRemoveUnnecessaryExpressionParenthesesDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.RemoveUnnecessarySuppressions.CSharpRemoveUnnecessaryInlineSuppressionsDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.RemoveUnnecessarySuppressions.CSharpRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryDiscardDesignation.CSharpRemoveUnnecessaryDiscardDesignationDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.RemoveRedundantEquality.CSharpRemoveRedundantEqualityDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.Analyzers.MatchFolderAndNamespace.CSharpMatchFolderAndNamespaceDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.NewLines.EmbeddedStatementPlacement.EmbeddedStatementPlacementDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.NewLines.MultipleBlankLines.CSharpMultipleBlankLinesDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.NewLines.ConstructorInitializerPlacement.ConstructorInitializerPlacementDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.NewLines.ConsecutiveStatementPlacement.CSharpConsecutiveStatementPlacementDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.NewLines.ConsecutiveBracePlacement.ConsecutiveBracePlacementDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.ConvertTypeOfToNameOf.CSharpConvertTypeOfToNameOfDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.AddRequiredParentheses.CSharpAddRequiredPatternParenthesesDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.AddRequiredParentheses.CSharpAddRequiredExpressionParenthesesDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.AddAccessibilityModifiers.CSharpAddAccessibilityModifiersDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpAsAndNullCheckDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpIsAndCastCheckDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpUseNotPatternDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UsePatternCombinators.CSharpUsePatternCombinatorsDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseLocalFunction.CSharpUseLocalFunctionDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseExpressionBody.UseExpressionBodyDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseExpressionBodyForLambda.UseExpressionBodyForLambdaDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.UseAutoProperty.CSharpUseAutoPropertyAnalyzer,
Microsoft.CodeAnalysis.CSharp.SimplifyThisOrMe.CSharpSimplifyThisOrMeDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic.MakeLocalFunctionStaticDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.EmbeddedLanguages.CSharpRegexDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.Diagnostics.CSharpUnboundIdentifiersDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.Diagnostics.TypeStyle.CSharpUseExplicitTypeDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.Diagnostics.TypeStyle.CSharpUseImplicitTypeDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.Diagnostics.NamingStyles.CSharpNamingStyleDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.Diagnostics.AddBraces.CSharpAddBracesDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.Diagnostics.SimplifyTypeNames.CSharpSimplifyTypeNamesDiagnosticAnalyzer,
Microsoft.CodeAnalysis.CSharp.Diagnostics.Analyzers.CSharpPreferFrameworkTypeDiagnosticAnalyzer
Open the %USERPROFILE%\.omnisharp\omnisharp.json
file and change these settings including the documentAnalysisTimeoutMs
which is 10 seconds by default:
{
"RoslynExtensionsOptions": {
"enableDecompilationSupport": true,
"enableAnalyzersSupport": true,
"enableImportCompletion": true,
"enableAsyncCompletion": true,
"documentAnalysisTimeoutMs": 600000,
"LocationPaths": [
"c:/Users/Vahid/.vscode/extensions/josefpihrt-vscode.roslynator-3.2.2/roslyn/common",
"c:/Users/Vahid/.vscode/extensions/josefpihrt-vscode.roslynator-3.2.2/roslyn/analyzers",
"c:/Users/Vahid/.vscode/extensions/josefpihrt-vscode.roslynator-3.2.2/roslyn/refactorings",
"c:/Users/Vahid/.vscode/extensions/josefpihrt-vscode.roslynator-3.2.2/roslyn/fixes"
]
}
}
I have installed the Roslynator too.
I'm attempting to use Omnisharp with the Roslyn analyzers feature enabled (in VSCode) and it keeps timing out on a particularly large file containing my database context that was generated by Entity Framework Core's scaffolding tools. The database description and files in question aren't mine to distribute, so I'm unable to provide them to help reproduce. Is there a way to set the timeout myself since I expect this to take a while to process? The Project Load Timeout option, even set to a ridiculously long 5 minutes doesn't change anything.
I'm using the latest stable versions of the extensions and .NET Core SDK.
Omnisharp log below.
The only packages bringing in analyzers currently are Entity Framework's diagnostic analyzer