Could not load type 'xe881e4987a64f736' from assembly 'Aspose.Cells...

Last post 07-23-2009, 1:15 PM by dybrn. 9 replies.
Sort Posts: Previous Next
  •  07-17-2009, 3:52 PM 189032

    Could not load type 'xe881e4987a64f736' from assembly 'Aspose.Cells... .NET

    Attachment: Present (inaccessible)

    There is a bug loading the types included in the Aspose.Cells.dll assembly versions 4.7.0.0 and 4.7.1.0 in 64-bit Windows.  These same assemblies load their types successfully on 32-bit Windows.  I have written a program (see attached) to load the assembly from the disk and enumerate the types in the assembly.

     

    The exception message from loading the types is “Could not load type 'xe881e4987a64f736' from assembly 'Aspose.Cells, Version=4.7.1.0, Culture=neutral, PublicKeyToken=716fcc553a201e56' because it contains an object field at offset 4 that is incorrectly aligned or overlapped by a non-object field.”

     
  •  07-18-2009, 1:01 AM 189052 in reply to 189032

    Re: Could not load type 'xe881e4987a64f736' from assembly 'Aspose.Cells...

    Hi,

    It looks that you are using the Aspose.Cells.dll component version compiled on .NET1.0 in ".....\Aspose\Aspose.Cells\Bin\Net1.0". Please use Aspose.Cells.dll component in "\Aspose\Aspose.Cells\Bin\Net2.0" which works fine on 64-bit environments. For reference, see the document: http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/using-aspose-cells-for-net-on-32bit-and-64bit-platforms.html

     

    Kindly let us know if it works fine now.

    Thank you.


    Amjad Sahi
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  07-20-2009, 11:17 AM 189215 in reply to 189052

    Re: Could not load type 'xe881e4987a64f736' from assembly 'Aspose.Cells... .NET

    I did use the .NET 2.0 assembly.
    It does not appear that you looked at the source I provided.
    Please run the code I provided (attached in the first post), pass in the .net 2.0 version Aspose.cells.dll and you will be able to reproduce the issue. (other .net 2.0 aspose assemblies work fine)

    Here is the code (again) to reproduce the issue:
    <CodeSnippet>

    namespace ClickCommerce.Test
    {
        using System;
        using System.Reflection;

        public sealed class Load
        {
            public static void Main(string[] args)
            {
                try {
                    if (args == null || args.Length == 0) {
                        Console.WriteLine("Load <assemblyFilePathFullyQualified>");
                        return;
                    }
                    // TODO: If path is relative, make it relative to the current directory.
                    Assembly asm = Assembly.LoadFile(args[0]);
                    Console.WriteLine(asm.GetName(false).FullName);
                    foreach (Type type in asm.GetTypes()) {
                        Console.WriteLine("  Type: {0}", type.FullName);
                    }
                } catch (ReflectionTypeLoadException rtle) {
                    WriteException(string.Empty, rtle);
                    Console.WriteLine();
                    foreach (Exception le in rtle.LoaderExceptions) {
                        WriteException("  ", le);
                    }
                } catch (Exception e) {
                    WriteException(string.Empty, e);
                }
            }

            private static void WriteException(string indent, Exception e)
            {
                Console.WriteLine("{4}Exception: {1}: {2}{0}{3}", Environment.NewLine, e.GetType().FullName, e.Message, e.StackTrace, indent);
            }
        }
    }
    </CodeSnippet>

     
  •  07-20-2009, 1:14 PM 189242 in reply to 189215

    Re: Could not load type 'xe881e4987a64f736' from assembly 'Aspose.Cells...

    Hi,

    Well, we did utilize your code in vs.net 2005 with both .NET1.x and .NET2.0 compiled versions of Aspose.Cells component, it works absolutely fine on my machine (WinXp, 32-bit). It provides all the type info on the console without any error or issue. We will try to check it on 64-bit environment if we could find the issue. We will get back to you soon.

    Thank you.


    Amjad Sahi
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  07-20-2009, 1:59 PM 189252 in reply to 189242

    Re: Could not load type 'xe881e4987a64f736' from assembly 'Aspose.Cells...

    That is correct.
    The code will work just fine on a 32 bit machine.
    If you try it on a 64 bit machine it WILL fail.

     
  •  07-22-2009, 2:26 AM 189590 in reply to 189252

    Re: Could not load type 'xe881e4987a64f736' from assembly 'Aspose.Cells...

    Attachment: Present (inaccessible)

    Hi,

    Could you try the attached latest .NET2.0 compiled version/fix.

    Thank you.


    Amjad Sahi
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  07-22-2009, 12:16 PM 189723 in reply to 189590

    Re: Could not load type 'xe881e4987a64f736' from assembly 'Aspose.Cells...

    We tried the latest assembly.
    It did not work on 64bit windows. In 64-bit Windows (x64), we can successfully do the following:
    - load the assembly
    - retrieve the assembly name of the loaded assembly

    We CANNOT do the following:
    - Enumerate the types located in this assembly.  This means the "foreach (Type t in assembly.GetTypes()) {}" FAILS on 64-bit Windows.

    When running the sample program from the previous post, you get the following output:

    Aspose.Cells, Version=4.7.1.19, Culture=neutral, PublicKeyToken=716fcc553a201e56

    Exception: System.Reflection.ReflectionTypeLoadException: Unable to load one or
    more of the requested types. Retrieve the LoaderExceptions property for more inf
    ormation.
       at System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark)
       at System.Reflection.Assembly.GetTypes()
       at ClickCommerce.Test.Load.Main(String[] args)

      Exception: System.TypeLoadException: Could not load type 'xe881e4987a64f736' from assembly 'Aspose.Cells, Version=4.7.1.19, Culture=neutral, PublicKeyToken=716fcc553a201e56' because it contains an
    object field at offset 4 that is incorrectly aligned or overlapped by a non-object field.

    The message indicates that an object field is not properly aligned.  I would guess that your code obfuscator is not properly aligning all of the assembly attributes.  64-bit programs require different alignments than 32-bit programs.  This explains why this code work on 32-bit Windows, but does not work on 64-bit Windows.  I would guess that your assembly works fine on 64-bit Windows BEFORE the code obfuscation and breaks after the code obfuscation.

    My OS is Windows Server 2003 x64 + SP2.  I would expect that Windows XP x64 + SP2 would behave in the same way, but I have not test that OS.
     
  •  07-22-2009, 2:17 PM 189748 in reply to 189723

    Re: Could not load type 'xe881e4987a64f736' from assembly 'Aspose.Cells...

    Hi,

    Thank you for sharing the details regarding your issue.

    We will get back to you soon.

    Thank You & Best Regards,


    Nausherwan Aslam
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  07-23-2009, 4:15 AM 189871 in reply to 189748

    Re: Could not load type 'xe881e4987a64f736' from assembly 'Aspose.Cells...

    Attachment: Present (inaccessible)

    Hi,

    Could you try the attached version and let us know if the issue is resolved now.

    Thank you.


    Amjad Sahi
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  07-23-2009, 1:15 PM 189998 in reply to 189871

    Re: Could not load type 'xe881e4987a64f736' from assembly 'Aspose.Cells...

    Thank you.  That assembly works great on x64 and x86
     
View as RSS news feed in XML