.NETGURU
MissingMemberException
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-services' list.


Russ Nemhauser
-- Moved from [aspngfreeforall] to [ngfx-services] by Tony Stark <Click here to reveal e-mail address> --

Greetings all,

I'm writing a windows service that launches a Sub on a timer. This sub
queries the database and if there is work to be done, it grabs some
information form the database row and puts it into an instance of a class
that I created

Public Class StateObj
Friend ID As Integer
Friend Name As String
Friend Subject As String
Friend Body As String
Friend Recipient As MailRecipientProperties
Friend Personalize As Boolean
End Class

The service then calls

QueueUserWorkItem(New System.Threading.WaitCallback(AddressOf
ProcessMessage), myStateObj)

but when the ProcessMessage function runs:

Public Sub ProcessMessage(ByVal StateObj As Object)

I keep getting MissingMemberException the first time this sub tries to
access any of the members on StateObj. Its like none of them exist.

Does anyone know

1) What I'm talking about
2) What the problem is? It seems to occur no matter what member of StateObj
I'm calling.

Thanks,
Russ

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail.
http://www.hotmail.com

Reply to this message...
 
    
Paul D. Murphy
You probably need to explicitly cast the object. Maybe I'm wrong but I
use the same process in my services all the time. Here is some code from
my service/timer work method.

using System;

namespace ServiCentral.ListManager.Services.Bounce
{
    /// <summary>
    /// Service class that is responsible for processing a bounce
job
    /// for the scnc List Manager Windows Services.
    /// </summary>
    public class CoreService
    {
        /// <summary>
        /// this constructor stops this object from being
created
        /// </summary>
        private    CoreService()
        {
            //
        }

        /// <summary>
        /// Static Method that processes a bounced message job=20
        /// into the scnc List Manager Database.=20
        /// </summary>
        /// <param name=3D"obj">The object with the bouncer job
state.</param>
        public    static    void    Bounce(
            System.Object    obj
            )
        {
            ServiCentral.ListManager.Common.JobDetails
details;

            try
            {
                details    =3D obj as
ServiCentral.ListManager.Common.JobDetails;
            }
            catch(System.Exception    badDetails)
            {
=09
Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManager.Publish
(
                    (badDetails as
ServiCentral.ListManager.Common.InvalidJobDetailsException)
                    );

                return;
            }

            //    Create the text file reader
            System.IO.StreamReader textReader;

            //    Create the log file writer
            System.IO.StreamWriter    logWriter;
        =09
            //    Attempt to open the file. Exit on
failure
            try
            {
                textReader    =3D
details.DataFile.OpenText();
                logWriter    =3D
details.LogFile.AppendText();
        =09
                //    Create the current line and the
counter
                System.String    currentLine    =3D
System.String.Empty;
                System.Int32    count        =3D
0;

                //    Read each line and process the
line into the database
                while((currentLine =3D
textReader.ReadLine()) !=3D null)
                {
                    try
                    {
                        //    Parse the e-mail
address from the current line
=09
ServiCentral.Framework.Common.EMailAddress    email    =3D
=09
ServiCentral.Framework.Common.EMailAddress.Parse(ExtractEmailFromCHANGEL
OGLine(currentLine, logWriter));    // HACK: logwriter should be in
the framework??

                        //    Get the
connection string
                        //    imstance a
configuration reader
=09
System.Configuration.AppSettingsReader    configReader    =3D
                            new
System.Configuration.AppSettingsReader();

                        System.String
conString    =3D
=09
(System.String)configReader.GetValue("ServiCentral.Common.Database.ListM
anager.ConnectionString", typeof(System.String));

                        //    Execute the Sql
Helper
=09
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(
                            conString,
=09
"sp_BounceRecipient",
                            email.ToString()
                            );

    // HACK: test needs to live in the logger
if((System.String)configReader.GetValue("scncLMSERVICE.LogLevel",
typeof(System.String)) =3D=3D "FULL")        //HACK: FULL is
hardcoded move this out into an enum
                        {
                            //    Log the
line
logWriter.WriteLine("BOUNCED\t" + count.ToString() + "\t" +
email.ToString());
                        }

                        //    Increment the
counter
                        count++;
                    }
=09
catch(ServiCentral.Framework.Common.Exceptions.InvalidEmailFormatExcepti
on    badEmailExc)
                    {
                        //    write out the
error and exit
=09
Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManager.Publish
(
                            new
Microsoft.ApplicationBlocks.ExceptionManagement.BaseApplicationException
("There was an error processing bounce line\n\t" +
currentLine.ToString()));

                        //    log the error
=09
logWriter.WriteLine("BADADDRESS\t" + count.ToString());
                    }
=09
catch(System.Data.SqlClient.SqlException    dataExc)
                    {
                        //    write out the
error and exit
=09
Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManager.Publish
(
                            new
Microsoft.ApplicationBlocks.ExceptionManagement.BaseApplicationException
("There was a data error.", dataExc));

                        //    log the error
=09
logWriter.WriteLine("DATAERROR\t" + count.ToString());
                    }
                }

                textReader.Close();

                logWriter.WriteLine("COMPLETED\t" +
count.ToString());

                logWriter.Flush();
                logWriter.Close();

                //    instance an extenstions object
=09
ServiCentral.ListManager.Common.Extensions    extensions    =3D=09
                    new
ServiCentral.ListManager.Common.Extensions();

                //    rename the active file to done
and delete the job
                details.DataFile.Delete();
=09
details.LogFile.MoveTo(details.LogFile.FullName.Replace(extensions.Activ
e, extensions.Complete));
            }
            catch(Exception openExc)
            {
=09
Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManager.Publish
(
                    new
Microsoft.ApplicationBlocks.ExceptionManagement.BaseApplicationException
("Could not open file " + details.DataFile.Name + ". This thread will
now exit.", openExc));
            }
        }

//    maybe an ILineReader interface for this shit? Put them in a
class=20
//     What you think? Worth the effort?
//=09
        private    static    System.String
ExtractEmailFromCHANGELOGLine(
            System.String            line,
            System.IO.StreamWriter    logWriter
            )
        {
            try
            {
                String[] tempA =3D line.Split(Char.Parse("
"));
                return tempA[2];
            }
            catch(Exception    exc)
            {
                //    log the line
=09
logWriter.Write(DateTime.Now.ToFileTime().ToString());
                logWriter.Write("\tError Parsing Line:
");
                logWriter.WriteLine(line);

                exc    =3D    null;
                return    "Click here to reveal e-mail address";
            }
        }
    }
}

    Paul D. Murphy
    Click here to reveal e-mail address
    "Teamwork is a lot of people doing what I say."

-----Original Message-----
From: Russ Nemhauser [mailto:Click here to reveal e-mail address]=20
Sent: Thursday, June 27, 2002 2:21 PM
To: ngfx-services
Subject: [ngfx-services] MissingMemberException

-- Moved from [aspngfreeforall] to [ngfx-services] by Tony Stark
<Click here to reveal e-mail address> --

Greetings all,

I'm writing a windows service that launches a Sub on a timer. This sub=20
queries the database and if there is work to be done, it grabs some=20
information form the database row and puts it into an instance of a
class=20
that I created

Public Class StateObj
Friend ID As Integer
Friend Name As String
Friend Subject As String
Friend Body As String
Friend Recipient As MailRecipientProperties
Friend Personalize As Boolean
End Class

The service then calls

QueueUserWorkItem(New System.Threading.WaitCallback(AddressOf=20
ProcessMessage), myStateObj)

but when the ProcessMessage function runs:

Public Sub ProcessMessage(ByVal StateObj As Object)

I keep getting MissingMemberException the first time this sub tries to=20
access any of the members on StateObj. Its like none of them exist.

Does anyone know

1) What I'm talking about
2) What the problem is? It seems to occur no matter what member of
StateObj=20
I'm calling.

Thanks,
Russ

_________________________________________________________________
Join the world's largest e-mail service with MSN Hotmail.=20
http://www.hotmail.com

| [ngfx-services] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-services.asp =3D JOIN/QUIT

Reply to this message...
 
    
Russ Nemhauser
Hey man,

I needed to make the members Public instead of Friend. That did it.

Thanks,
Russ

[Original message clipped]

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx

Reply to this message...
 
 
System.Char
System.Configuration.AppSettingsReader
System.Data.SqlClient.SqlException
System.DateTime
System.Exception
System.Int32
System.IO.StreamReader
System.IO.StreamWriter
System.MissingMemberException
System.Object
System.String
System.Threading.WaitCallback




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification