[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

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

gurusoft

9/13/2004 6:07:00 AM

> 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
1 Answer

Sanjeeva

9/13/2004 10:07:00 PM

0

Fix the Version of your assembly before you rebuild register it. This you
can do it by setting "1.0.0.1" as the initial version... Hope it'll be
Helpful

--
Regards,
Sanjeevakumar Hiremath
__________________________
e-mail : Sanjeeva@proteans.com
Phone: 91-80-36880796
Office: 91-80-51217844
Fax : 91-80-51217536
MSN : sanjeeva_2k4@hotmail.com
YahooIM : jack_hide2000

"Franz" <gurusoft@bluemail.ch> wrote in message
news:df91ccfd.0409122206.4123adaf@posting.google.com...
> > 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