Page 1 of 1

Error accessing Types in Stimulsoft.Report.dll

Posted: Wed Oct 21, 2009 2:49 pm
by chris.procter
Hi!
As part of some non-report-related functionality, some of our code iterated over all Types in all the loaded Assemblies. This normally worked, but occasionally failed on some projects. After some confusion, it appears that accessing types for the Stimulsoft.Report.dll causes an exception.

I've made a quick test application in C# to demonstrate this. It will normally work, unless a reference to Stimulsoft.Report.dll is added.

Code: Select all

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

namespace SSTest1
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
                {
                    Console.WriteLine("Assembly: " + assembly.FullName + " at " + assembly.Location);
                    foreach (Type type in assembly.GetTypes())
                        Console.WriteLine("   Type: " + type.Name);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("\nOh no!  :-(\n");
                Console.WriteLine(ex.ToString());

                Console.WriteLine("\nProblem caused by: ");
                foreach (Exception le in ((ReflectionTypeLoadException)ex).LoaderExceptions)
                    Console.WriteLine(le.ToString());

            }
            Console.WriteLine("\nAll done!");
            Console.ReadKey();
            
            //Uncomment if not running in Debugger, as it behaves differently!
            Stimulsoft.Report.Viewer.IStiViewerControl it;
        }
    }
}
The error output is:
[...]
Assembly: Stimulsoft.Report, Version=2009.2.500.0, Culture=neutral, PublicKeyToken=ebe6666cba19647a at C:\Windows\assembly\GAC_MSIL\Stimulsoft.Report\2009.2.500.0__ebe6666cba19647a\Stimulsoft.Report.dll

Oh no! :-(

System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark)
at System.Reflection.Assembly.GetTypes()
at StimulsoftTest1.Program.Main(String[] args) in C:\Testing\SSTest1\Program.cs:line 18

Problem caused by:
System.TypeLoadException: Could not load type 'CRYPT_ALGORITHM_IDENTIFIER' from assembly 'Stimulsoft.Report, Version=2009.2.500.0, Culture=neutral, PublicKeyToken=ebe6666cba19647a' because it contains an object field at offset 4 that is incorrectly aligned or overlapped by a non-object field.
System.TypeLoadException: Could not load type 'CRYPT_ALGORITHM_IDENTIFIER' from assembly 'Stimulsoft.Report, Version=2009.2.500.0, Culture=neutral, PublicKeyToken=ebe6666cba19647a' because it contains an object field at offset 4 that is incorrectly aligned or overlapped by a non-object field.

All done!
(I believe we're running the release version of 2009.2, FYI)

Error accessing Types in Stimulsoft.Report.dll

Posted: Thu Oct 22, 2009 5:54 am
by Edward
Hi

Please try to remove Stimulsoft assemblies from the GAC. maybe the problem is connected with the fact that you referenced dlls and other thier copies had been found in the GAC.

I hope this helps.

Thank you.

Error accessing Types in Stimulsoft.Report.dll

Posted: Thu Oct 22, 2009 7:07 am
by Andrew
Hello,

We found the problem and we are working on fixing this problem.

Thank you.

Error accessing Types in Stimulsoft.Report.dll

Posted: Fri Oct 23, 2009 2:34 am
by Ivan
Hello,

Problem is solved.
Patch will be available in next prerelease build from 26-Oct-2009.

Thank you.