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 Code | Type | Error/Warning Description |
---|---|---|
CS4001 | Error | Cannot await ‘{0}’ |
CS4003 | Error | ‘await’ cannot be used as an identifier within an async method or lambda expression |
CS4004 | Error | Cannot await in an unsafe context |
CS4005 | Error | Async methods cannot have unsafe parameters or return types |
CS4006 | Error | __arglist is not allowed in the parameter list of async methods |
CS4007 | Error | ‘await’ cannot be used in an expression containing the type ‘{0}’ |
CS4008 | Error | Cannot await ‘void’ |
CS4009 | Error | A void or int returning entry point cannot be async |
CS4010 | Error | Cannot convert async {0} to delegate type ‘{1}’. An async {0} may return void, Task or Task\<T\>, none of which are convertible to ‘{1}’. |
CS4011 | Error | ‘await’ requires that the return type ‘{0}’ of ‘{1}.GetAwaiter()’ have suitable ‘IsCompleted’, ‘OnCompleted’, and ‘GetResult’ members, and implement ‘INotifyCompletion’ or ‘ICriticalNotifyCompletion’ |
CS4012 | Error | Parameters or locals of type ‘{0}’ cannot be declared in async methods or async lambda expressions. |
CS4013 | Error | Instance of type ‘{0}’ cannot be used inside a nested function, query expression, iterator block or async method |
CS4014 | Warning | Because 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. |
CS4015 | Error | ‘MethodImplOptions.Synchronized’ cannot be applied to an async method |
CS4016 | Error | Since this is an async method, the return expression must be of type ‘{0}’ rather than ‘Task\<{0}>‘ |
CS4017 | Error | CallerLineNumberAttribute cannot be applied because there are no standard conversions from type ‘{0}’ to type ‘{1}’ |
CS4018 | Error | CallerFilePathAttribute cannot be applied because there are no standard conversions from type ‘{0}’ to type ‘{1}’ |
CS4019 | Error | CallerMemberNameAttribute cannot be applied because there are no standard conversions from type ‘{0}’ to type ‘{1}’ |
CS4020 | Error | The CallerLineNumberAttribute may only be applied to parameters with default values |
CS4021 | Error | The CallerFilePathAttribute may only be applied to parameters with default values |
CS4022 | Error | The CallerMemberNameAttribute may only be applied to parameters with default values |
CS4023 | Error | /platform:anycpu32bitpreferred can only be used with /t:exe, /t:winexe and /t:appcontainerexe |
CS4024 | Warning | The 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 |
CS4025 | Warning | The 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 |
CS4026 | Warning | The 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 |
CS4027 | Error | ‘{0}’ does not implement ‘{1}’ |
CS4028 | Error | ‘await’ requires that the type ‘{0}’ have a suitable ‘GetAwaiter’ method. Are you missing a using directive for ‘System’? |
CS4029 | Error | Cannot return an expression of type ‘void’ |
CS4030 | Error | Security attribute ‘{0}’ cannot be applied to an Async method. |
CS4031 | Error | Async methods are not allowed in an Interface, Class, or Structure which has the ‘SecurityCritical’ or ‘SecuritySafeCritical’ attribute. |
CS4032 | Error | The ‘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}>‘. |
CS4033 | Error | The ‘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’. |
CS4034 | Error | The ‘await’ operator can only be used within an async {0}. Consider marking this {0} with the ‘async’ modifier. |
CS4036 | Error | ‘{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}’?) |
CS5001 | Error | Program does not contain a static ‘Main’ method suitable for an entry point |