Error accessing Types in Stimulsoft.Report.dll

Stimulsoft Reports.NET discussion
Post Reply
chris.procter
Posts: 32
Joined: Wed Jun 10, 2009 4:48 pm
Location: Edmonton

Error accessing Types in Stimulsoft.Report.dll

Post 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)
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Error accessing Types in Stimulsoft.Report.dll

Post 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.
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Error accessing Types in Stimulsoft.Report.dll

Post by Andrew »

Hello,

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

Thank you.
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Error accessing Types in Stimulsoft.Report.dll

Post by Ivan »

Hello,

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

Thank you.
Post Reply