-
CS0019: Operator '&' cannot be applied to operands of type 'type' and 'type'
This happens when you are trying to use the wrong operator for the specific operation.
- CS0029: Cannot implicitly convert type 'object' to 'string'
-
CS0103: The name 'whatever' does not exist in the class or namespace / CS0246: The type or namespace name 'whatever' could not be found (are you missing a using directive or an assembly reference?)
This will usually occur when you have not declared a variable globally and or it's missing altogether. CS0246 error also occurs when you are improperly declaring a object or variable, as well as it not existing in your code.
- CS0117: 'object' does not contain a definition for 'Length'
This error occurs when you are typically trying to present an object as a string. The solution here is to append ".ToString()," that now represents the object as a string.
-
CS0118: 'System.Configuration.ConfigurationSettings.AppSettings' denotes a 'property' where a 'method' was expected
This error occurs when your AppSettings key is accessed with parentheses in VB, instead of brackets in C# or vice-versa.
-
CS0119: 'whatever' denotes a 'class' which is not valid in the given context
One cause of this error is to improperly call an object without the "new" keyword in C# and "As New" in VB
- Object reference not set to an instance of an object
Again this has to do with improperly trying to convert a value. To remedy this properly cast or box the value in question.
This runtime error is more often than not caused by your code trying to reference an object that is not available, and for the most part you've probably closed the object or set it to null or nothing somewhere in your code in all valiant attempts to clean up any unnecessary objects from memory. For example, a connection object you've opened and used, but now somewhere you've closed it and set it to nothing, and somewhere after in the code it's being called again and when it does you'll get this error. Find and delete the line and close and null your object later on. Notwithstanding, this runtime error will also occur in the circumstances shown above in CS0119.
-
CS0161: 'method name': not all code paths return a value
This will happen when you are trying to make a function method behave like a subroutine or vice-versa. Use the proper method keyword to remedy this. Void is for methods that do not return a value, although you could response write the output. Whereas, applying a keyword value like string, int, works alongside a return value at the end of the method.
- CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
- If you call an object that requires parentheses () after the command, you'll get this error. Ex. database.Open() not database.Open
- Using an assignment operator as opposes to an equality operator
-
CS1001: Identifier expected / BC30183: Keyword is not valid as an identifier.
Both these similar errors occur when you forget to identify a variable without a keyword, or you were inadvertently forcing a keyword to behave as a variable or type.
- BC30451: Name 'whatever' is not declared.
This error is produced by a number of sources.
-
BC30512: Option Strict On disallows implicit conversions from 'type' to 'type'.
Improper type conversions produce this error. Convert the value or method to the proper cast to fix this.
-
BC30554/BC30560: 'object' is ambiguous.
This error occurs when you have more than one similarly named dll in your bin folder when compiling or it matched your control inherits call. Furthermore, more than one dll root namespace or class within are named the same. Your page or control are trying to access one source file where a source file and dll may simultaneously exist.
- BC30574: Option Strict On disallows late binding
This happens when you are referencing a web form control or variable that either doesn't exist or is named different. Also by chance the control in question may be missing the mandatory runat="server" option.
- Not setting the object's proper data type
- An expression that binds data was incorrectly parsed against the object at runtime In Datagrids, for instance, this occurs when omitting the DataBinder.Eval method on a data field
This can happen from any number of reasons in your code. Some common ones are:
- BC30684: 'name' is a type and cannot be used as an expression
This can happen usually when you forget to use the new keyword when instantiating an object or invoking a constructor.
Comments