locked
information about the containing class? RRS feed

  • Question

  • hi  I have a solution with 2 projects.
    i am referrring a dll from project1 into project2 and project2 is the executable project in the
    solution.

    While trying to run the project after successful compilation, I get an error
    Cannot fetch the value of field 'myField' because information about the containing class is unavailable.

    When I try to debug, I see the value of myField as null in the object.
    Not only that myField, all other fields have a value as null.

    I am invoking the class containing the myfield from my code as:

     

    tokens = Clsr.GetConstructor(new Type[] { }).Invoke(null);

    as my constructor does not take any parameters and does nothing

     

    code for constructor:

     

    public tokens() { }

     

    Can anyone tell me what's wrong with this?


    thanks in advance.

    Thursday, June 19, 2008 1:37 PM

Answers

  • An empty constructor certainly explains why all the object fields are null.  You'll have to show us the code snippet and stack trace for the exception.
    Friday, June 20, 2008 1:48 AM
  • I found that the problem is with initalizing the class

    using the initialiseclass(string str) method

     

    here the values are null.

    Friday, June 20, 2008 6:08 AM

All replies

  • hi  I have a solution with 2 projects.
    i am referrring a dll from project1 into project2 and project2 is the executable project in the
    solution.

    While trying to run the project after successful compilation, I get an error
    Cannot fetch the value of field 'myField' because information about the containing class is unavailable.

    When I try to debug, I see the value of myField as null in the object.
    Not only that myField, all other fields have a value as null.

    I am invoking the class containing the myfield from my code as:

     

    tokens = Clsr.GetConstructor(new Type[] { }).Invoke(null);

    as my constructor does not take any parameters and does nothing

     

    code for constructor:

     

    public tokens() { }

     

    Can anyone tell me what's wrong with this?


    thanks in advance.

    Thursday, June 19, 2008 1:37 PM
  • hi  I have a solution with 2 projects.
    i am referrring a dll from project1 into project2 and project2 is the executable project in the
    solution.

    While trying to run the project after successful compilation, I get an error
    Cannot fetch the value of field 'myField' because information about the containing class is unavailable.

    When I try to debug, I see the value of myField as null in the object.
    Not only that myField, all other fields have a value as null.

    I am invoking the class containing the myfield from my code as:

     

    tokens = Clsr.GetConstructor(new Type[] { }).Invoke(null);

    as my constructor does not take any parameters and does nothing

     

    code for constructor:

     

    public tokens() { }

     

    Can anyone tell me what's wrong with this?


    thanks in advance.

    Thursday, June 19, 2008 1:37 PM
  • An empty constructor certainly explains why all the object fields are null.  You'll have to show us the code snippet and stack trace for the exception.
    Friday, June 20, 2008 1:48 AM
  • I found that the problem is with initalizing the class

    using the initialiseclass(string str) method

     

    here the values are null.

    Friday, June 20, 2008 6:08 AM