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
The following default code for a new Windows Service (.NET Framework) project shows waring CC0022 but throws the exception below when viewing potential fixes.
namespace WindowsService1
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new Service1()
};
ServiceBase.Run(ServicesToRun);
}
}
}
System.InvalidCastException : Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.InitializerExpressionSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionStatementSyntax'.
at CodeCracker.CSharp.Usage.DisposableVariableNotDisposedCodeFixProvider.CreateUsing(SyntaxNode root,ObjectCreationExpressionSyntax objectCreation,SemanticModel semanticModel)
at async CodeCracker.CSharp.Usage.DisposableVariableNotDisposedCodeFixProvider.CreateUsingAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.CodeActions.CodeAction.GetChangedSolutionAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.CodeActions.CodeAction.ComputeOperationsAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.CodeActions.CodeAction.GetPreviewOperationsAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedAction.GetPreviewResultAsync(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedActionWithNestedFlavors.<>c__DisplayClass11_0.<GetPreviewAsync>b__0(<Unknown Parameters>)
at async Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.PerformFunctionAsync[T](<Unknown Parameters>)
The text was updated successfully, but these errors were encountered:
jeffreympolk
changed the title
System.InvalidCastException thrown on object initializer
CC0022: System.InvalidCastException thrown on object initializer
Mar 26, 2019
jeffreympolk
changed the title
CC0022: System.InvalidCastException thrown on object initializer
CC0022: System.InvalidCastException thrown on Initializer Expression
Mar 26, 2019
The following default code for a new Windows Service (.NET Framework) project shows waring CC0022 but throws the exception below when viewing potential fixes.
The text was updated successfully, but these errors were encountered: