TypeLoadException

2005-01-12
2013-04-25
  • Martin Szugat

    Martin Szugat - 2005-01-12

    No matter what type from Saxon.NET.dll (e.g. net.sf.saxon.Configuration) I try to reference in my project I get a TypeLoadException telling me the type could not be loaded. My project (C#)references Saxon.NET.dll, IKVM.GNU.Classpath.dll and IKVM.Runtime.dll. All files are in the same directory.

    If I open your winapp sample project and execute it, it works fine. It works even if I replace your code with the code from my project. I already compared the project settings but didn't find any differences.

     
    • Pieter Siegers

      Pieter Siegers - 2005-01-12

      Hi hampti,

      well, I'll need to have a look at your code. You can post it here as text or send the project in a zip file to psiegers2002 (at) yahoo.com.

      My code runs because my references point directly to the dlls in the bin subdirectory of the project. Check first where your references are pointed to and above all check the versions os the builds - you may have different ones. My reccomendation is to use the ones that come with the example app, as the newer ones are not fully tested yet.

      Cheers,
      <prs/>

       
    • Martin Szugat

      Martin Szugat - 2005-01-12

      Hi Pieter,

      Thanks for your fast response. The code is:

      using System;
      using net.sf.saxon;
      using net.sf.saxon.query;

      namespace Saxon.NET
      {
          class Class1
          {
              [STAThread]
              static void Main(string[] args)
              {
                  Configuration conf = new Configuration();
              }
          }
      }

      I did already copied the DLLs from the example project to bin directory (send you a copy to the email address). Maybe it is because I'm using the german version of VS.NET? But in this case the winapp example project should fail either.

      Greetings

      Martin

       
    • Pieter Siegers

      Pieter Siegers - 2005-01-13

      Hi Martin,

      did you add the references to your project in the Solution Explorer? To do that, you should first copy the dll set to your bin subdirectory, then in your project right-click the references folder, and add the three references.

      I see you're developing a command line application; however, there's no need to do that because you can use Transform.exe directly from the commandline. If you want you can create a batch file and run both Saxon and Saxon.NET to see how both behave and compare results.

      An example of a batch command could be:

      REM Usage: Transform [options] source-doc style-doc {param=value}...

      > Transform E:\temp\abc.xml E:\temp\abc.xsl

      Execute 'Transform' will get you the option list printed out on the screen.

      HTH,
      <prs/>

       
      • Martin Szugat

        Martin Szugat - 2005-01-13

        > did you add the references to your project in the Solution Explorer?

        Yes, I did.

        > I see you're developing a command line application;

        Not really, just for testing.

        I solved the problem: I copied the winapp example project and replaced the source code files.

        But I still do not know why my project file doesn't work.

        Martin

         
    • Pieter Siegers

      Pieter Siegers - 2005-01-13

      OK Martin thanx for telling me it works - now it's much less important why yours didn't, but you may find it afterwards.

      Cheers,
      <prs/>

       
    • Pieter Siegers

      Pieter Siegers - 2005-01-16

      Hi Martin,

      you cannot use the Configuration class in a static method; you can create a class however that makes use of the Configuration class, and then call into it from within Main, using a new instance of the class.

      You now know why the error was generated.

      Cheers,
      <prs/>

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks