Could not load type .... (assebley in GAC, with new singleton class)

Discussion in 'ASP .Net' started by Franz, Sep 11, 2004.

  1. Franz

    Franz Guest

    Hello NG

    I added a new tracelog class in a existing assebley witch is located
    in GAC.
    If I try to access a methode of this new class I'll get an
    errormeassage like this: Could not load type xxxx from assembly xxxx,
    Version=1.0.4850.0, Culture=neutral, PublicKeyToken=302009412214000a.

    I searched in ng and found some tasks, like 'do not use enums' or
    'make sure you rebuild asembley before creating a new msi', 'check
    namespace', 'reboot' and so on. But I still get the same error.

    My class is a singleton an look like this:

    using System;
    using System.IO;
    using System.Diagnostics;

    namespace xxx
    {
    public sealed class TraceLog
    {
    private static TraceLog _traceLog;

    private FileStream fileStream = null;
    private TextWriterTraceListener textWriterTraceListener = null;

    public enum TraceLogTyp
    {
    CustomError,
    FatalError,
    Check,
    }

    private TraceLog()
    {
    fileStream = new FileStream(AppDomain.CurrentDomain.BaseDirectory +
    "trace.txt", FileMode.OpenOrCreate);
    textWriterTraceListener = new TextWriterTraceListener(fileStream);
    Trace.Listeners.Add(textWriterTraceListener);
    }

    public static TraceLog GetInstance()
    {
    if (_traceLog == null)
    {
    _traceLog = new TraceLog();
    }

    return _traceLog;
    }

    public void WriteTraceLog(string namespaceName,
    ArgusNet.Fifa.WebFast.BusinessFacade.TraceLog.TraceLogTyp traceLogTyp,
    string logMessage)
    {
    StackTrace stackTrace = null;

    try
    {
    stackTrace = new StackTrace();
    string methodeName =
    stackTrace.GetFrame(1).GetMethod().Name.ToString();

    string message = String.Concat(DateTime.Now.ToString(), " -
    ",traceLogTyp, " - ", namespaceName, " - ", methodeName, ": ",
    logMessage);
    Trace.WriteLine(message);
    Trace.Flush();
    textWriterTraceListener.Flush();
    }
    catch(Exception ex)
    {
    int i = 11;
    //destroy excepetion
    }
    finally
    {
    stackTrace = null;
    }
    }
    }
    }

    If I call TraceLog.GetInstance().WriteTraceLog("aaa",
    xxx.TraceLog.Check, "ccc");

    Does anyone have any idea!!
    Many thanks in advance
    Franz
     
    Franz, Sep 11, 2004
    #1
    1. Advertisements

  2. Franz

    Jared Guest

    You sould post this in the Remoting newsgroup.
     
    Jared, Sep 11, 2004
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.