HomeCSharpC# Compiler Error Codes CS4001 to CS6000

C# Compiler Error Codes CS4001 to CS6000

In this post, you’ll learn all the C# compiler error and warnings from the code CS4001 to CS6000.

C# Compiler Error Codes CS4001 to CS6000

Error CodeTypeError/Warning Description
CS4001ErrorCannot await ‘{0}’
CS4003Error‘await’ cannot be used as an identifier within an async method or lambda expression
CS4004ErrorCannot await in an unsafe context
CS4005ErrorAsync methods cannot have unsafe parameters or return types
CS4006Error__arglist is not allowed in the parameter list of async methods
CS4007Error‘await’ cannot be used in an expression containing the type ‘{0}’
CS4008ErrorCannot await ‘void’
CS4009ErrorA void or int returning entry point cannot be async
CS4010ErrorCannot convert async {0} to delegate type ‘{1}’. An async {0} may return void, Task or Task\<T\>, none of which are convertible to ‘{1}’.
CS4011Error‘await’ requires that the return type ‘{0}’ of ‘{1}.GetAwaiter()’ have suitable ‘IsCompleted’, ‘OnCompleted’, and ‘GetResult’ members, and implement ‘INotifyCompletion’ or ‘ICriticalNotifyCompletion’
CS4012ErrorParameters or locals of type ‘{0}’ cannot be declared in async methods or async lambda expressions.
CS4013ErrorInstance of type ‘{0}’ cannot be used inside a nested function, query expression, iterator block or async method
CS4014WarningBecause this call is not awaited, execution of the current method continues before the call is completed. Consider applying the ‘await’ operator to the result of the call.
CS4015Error‘MethodImplOptions.Synchronized’ cannot be applied to an async method
CS4016ErrorSince this is an async method, the return expression must be of type ‘{0}’ rather than ‘Task\<{0}>‘
CS4017ErrorCallerLineNumberAttribute cannot be applied because there are no standard conversions from type ‘{0}’ to type ‘{1}’
CS4018ErrorCallerFilePathAttribute cannot be applied because there are no standard conversions from type ‘{0}’ to type ‘{1}’
CS4019ErrorCallerMemberNameAttribute cannot be applied because there are no standard conversions from type ‘{0}’ to type ‘{1}’
CS4020ErrorThe CallerLineNumberAttribute may only be applied to parameters with default values
CS4021ErrorThe CallerFilePathAttribute may only be applied to parameters with default values
CS4022ErrorThe CallerMemberNameAttribute may only be applied to parameters with default values
CS4023Error/platform:anycpu32bitpreferred can only be used with /t:exe, /t:winexe and /t:appcontainerexe
CS4024WarningThe CallerLineNumberAttribute applied to parameter ‘{0}’ will have no effect because it applies to a member that is used in contexts that do not allow optional arguments
CS4025WarningThe CallerFilePathAttribute applied to parameter ‘{0}’ will have no effect because it applies to a member that is used in contexts that do not allow optional arguments
CS4026WarningThe CallerMemberNameAttribute applied to parameter ‘{0}’ will have no effect because it applies to a member that is used in contexts that do not allow optional arguments
CS4027Error‘{0}’ does not implement ‘{1}’
CS4028Error‘await’ requires that the type ‘{0}’ have a suitable ‘GetAwaiter’ method. Are you missing a using directive for ‘System’?
CS4029ErrorCannot return an expression of type ‘void’
CS4030ErrorSecurity attribute ‘{0}’ cannot be applied to an Async method.
CS4031ErrorAsync methods are not allowed in an Interface, Class, or Structure which has the ‘SecurityCritical’ or ‘SecuritySafeCritical’ attribute.
CS4032ErrorThe ‘await’ operator can only be used within an async method. Consider marking this method with the ‘async’ modifier and changing its return type to ‘Task\<{0}>‘.
CS4033ErrorThe ‘await’ operator can only be used within an async method. Consider marking this method with the ‘async’ modifier and changing its return type to ‘Task’.
CS4034ErrorThe ‘await’ operator can only be used within an async {0}. Consider marking this {0} with the ‘async’ modifier.
CS4036Error‘{0}’ does not contain a definition for ‘{1}’ and no extension method ‘{1}’ accepting a first argument of type ‘{0}’ could be found (are you missing a using directive for ‘{2}’?)
CS5001ErrorProgram does not contain a static ‘Main’ method suitable for an entry point

Leave a Reply

You May Also Like

This C# program calculates and displays an upper triangular matrix based on user input. Problem Statement: The program takes the...
This C# program serves as a demonstration of bitwise operators, which are fundamental operators used for manipulating individual bits in...
This C# program is designed to interchange or swap the columns of a matrix. A matrix is a two-dimensional array...