Windows Phone Developers

Showing posts with label .NET Error Codes. Show all posts
Showing posts with label .NET Error Codes. Show all posts

Wednesday, July 10, 2013

System.Windows.Markup.XamlParseException occurred 'xClassCanOnlyBeUsedOnLoadComponent'.

 
System.Windows.Markup.XamlParseException occurred ClassCanOnlyBeUsedOnLoadComponent'. I was blank when this error has shot. Finally caught hold of the problem - A Space . 

 


All I had to do was to remove the space. Replace

x:Class ="SabarimalaiAyyapa.Page2"

with

x:Class="SabarimalaiAyyapa.Page2" Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Sunday, March 28, 2010

Invalid expression term '>'


Only assignment, call, increment, decrement, and new object expressions can be used as a statement

Invalid expression term '>'

The error is most likely for some VB programmer coding C#. The following snippet shows you why:

Wrong

if (value.Length <> 0)



Correct

if (value.Length != 0)

or

if (value.Length > 0)



VB Programmers tend to use <>:) Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Saturday, October 18, 2008

The type or namespace name 'type/namespace' could not be found (are you missing a using directive or an assembly reference?) [Compiler Error CS0246]

Solution : The type or namespace name 'XElement' could not be found (are you missing a using directive or an assembly reference?)



Error Code

using System;

using System.Collections.Generic;

using System.Linq;

XElement Inv = new XElement("Invoice",

from items in FileContent

let fields = items.Split(',')

select new XElement("Item",

new XElement("ID", fields[0]),

new XElement("Name", fields[1]),

new XElement("Price", fields[2]),

new XElement("Availability", fields[3])

Solution

Inclusion of using System.Xml.Linq directive will solve the problem

System.Xml.Linq, C# Error codes, .Net Error codes, 'XElement' in C#, 'XElement' in .NET Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

The ' ' character, hexadecimal value 0x20, cannot be included in a name.

Solution : "The ' ' character, hexadecimal value 0x20, cannot be included in a name."

XML Tag should not contain any white spaces.

Change

new XElement("Total Price", fields[4])

to

new XElement("TotalPrice", fields[4])


Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Sunday, August 24, 2008

The best overloaded Add method 'name for the collection initializer has some invalid arguments in ‘ToString’

The type of one argument in a method does not match the type that was passed when the class was instantiated.

The best overloaded method match for 'System.Windows.Forms.MessageBox.Show(string)' has some invalid arguments

Solution : One possible solution is to check if the ‘ToString’ has braces

System.Text.StringBuilder CompleteAddress1 = new

System.Text.StringBuilder();

CompleteAddress1.Append( "105, Annanagar ");

CompleteAddress1.Append( "Chennai ");

CompleteAddress1.Append( "Tamil Nadu ");

‘ Error Line

MessageBox.Show(CompleteAddress1.ToString );

‘ Solution

MessageBox.Show(CompleteAddress1.ToString() );

Argument '1': cannot convert from 'method group' to 'string'




The best overloaded Add method 'name for the collection initializer has some invalid arguments in ‘ToString’ Error
Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Sunday, April 27, 2008

Function '' doesn't return a value on all code paths


Function '' doesn't return a value on all code paths


The error Function '' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used occurs when a Function procedure has at least one possible path through its code that does not return a value.

You can return a value from a Function procedure in any of the following ways:

· Assign the value to the Function procedure name and then perform an Exit Function statement.

· Assign the value to the Function procedure name and then perform the End Function statement.

· Include the value in a Return Statement (Visual Basic).

If control passes to Exit Function or End Function and you have not assigned any value to the procedure name, the procedure returns the default value of the return data type.

Error ID: BC42105

To correct this error

· Check your control flow logic and make sure you assign a value before every statement that causes a return.

It is easier to guarantee that every return from the procedure returns a value if you always use the Return statement. If you do this, the last statement before End Function should be a Return statement.

Most often this kind of error happens when the return is missed in the Catch block. It would be advisable to return a value for the error too as shown below

Function ReturnSomeVal() As String

Try

Dim Svalue As String

' Processing

Return sValue

Catch ex As Exception

Return vbNullString

Finally

End Try

End Function

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

Late bound resolution in .NET

Late bound resolution; runtime errors could occur

This error (Error ID: BC42017) occurs because an object is assigned to a variable declared to be of the Object Data Type.

When you declare a variable as Object, the compiler must perform late binding, which causes extra operations at run time. It also exposes your application to potential run-time errors. For example, if you assign a Form to the Object variable and then try to access the XmlDocument..::.NameTable property, the runtime throws a MemberAccessException because the Form class does not expose a NameTable property.

If you declare the variable to be of a specific type, the compiler can perform early binding at compile time. This results in improved performance, controlled access to the members of the specific type, and better readability of your code.

To avoid this error it is better to declare the data type of the variable

Private app As Excel.Application

Instead of

Private app As Object


Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon