Results 1 to 2 of 2

Thread: System.Reflection.ReflectionTypeLoadException

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2009
    Location
    sydney
    Posts
    265

    System.Reflection.ReflectionTypeLoadException

    my code works on my dev PC, however when i deploy it on clients server, i get the Error. I ensured all references are set to copy to local. and copied them to clients server. any suggestions ??
    Thanks in advance

    Code:
    try
                {
                    gridControl1.DataSource = lCom.DB.CUSTOMERS.Select(x => new CusDisplay() { ID = x.UniqueID, Code = x.CustomerCode, Title = x.CustomerTitle, GroupNo = (int)x.GroupNo, Group = x.CustomerGroup }).ToList();
                    GRD.PopulateColumns();
                    // hide the unique ID field //
                    GRD.Columns[0].Visible = false;
                }
                catch (Exception ex)
                {
                    if (ex is System.Reflection.ReflectionTypeLoadException)
                    {
                        var typeLoadException = (System.Reflection.ReflectionTypeLoadException)ex;
                        var loaderExceptions = typeLoadException.LoaderExceptions;
                    }
                    MSG(ex.ToString());
                }
               
            }
    Code:
     public class CusDisplay
        {
            public string ID    {get; set;}
            public string Code  {get; set;}
            public string Title { get; set;}
            public string Group { get; set;}
            public int GroupNo  { get; set; }
            public int PriceScale { get; set; }
        }

    Error
    System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
    at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
    at System.Reflection.RuntimeModule.GetTypes()
    at System.Reflection.Assembly.GetTypes()
    at System.Data.Metadata.Edm.ObjectItemAttributeAssemblyLoader.LoadTypesFromAssembly()
    at System.Data.Metadata.Edm.ObjectItemAssemblyLoader.Load()
    at System.Data.Metadata.Edm.ObjectItemAttributeAssemblyLoader.Load()
    at System.Data.Metadata.Edm.AssemblyCache.LoadAssembly(Assembly assembly, Boolean loadReferencedAssemblies, ObjectItemLoadingSessionData loadingData)
    at System.Data.Metadata.Edm.AssemblyCache.LoadAssembly(Assembly assembly, Boolean loadReferencedAssemblies, KnownAssembliesSet knownAssemblies, EdmItemCollection edmItemCollection, Action`1 logLoadMessage, Object& loaderCookie, Dictionary`2& typesInLoading, List`1& errors)
    at System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyFromCache(ObjectItemCollection objectItemCollection, Assembly assembly, Boolean loadReferencedAssemblies, EdmItemCollection edmItemCollection, Action`1 logLoadMessage)
    at System.Data.Metadata.Edm.ObjectItemCollection.ImplicitLoadAssemblyForType(Type type, EdmItemCollection edmItemCollection)
    at System.Data.Metadata.Edm.MetadataWorkspace.ImplicitLoadAssemblyForType(Type type, Assembly callingAssembly)
    at System.Data.Objects.ObjectContext.GetTypeUsage(Type entityCLRType)
    at System.Data.Objects.ObjectContext.GetEntitySetForNameAndType(String entitySetName, Type entityCLRType, String exceptionParameterName)
    at System.Data.Objects.ObjectContext.CreateObjectSet[TEntity](String entitySetName)
    at SpecialPricesTool.ABMEntities.get_CUSTOMERS()
    at SpecialPricesTool.Form1.PopulateGrd()
    at SpecialPricesTool.Form1.Form1_Load(Object sender, EventArgs e)
    at System.EventHandler.Invoke(Object sender, EventArgs e)
    at System.Windows.Forms.Form.OnLoad(EventArgs e)
    at DevExpress.XtraEditors.XtraForm.OnLoad(EventArgs e)
    at System.Windows.Forms.Form.OnCreateControl()
    at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
    at System.Windows.Forms.Control.CreateControl()
    at System.Windows.Forms.Control.WmShowWindow(Message& m)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
    at System.Windows.Forms.Form.WmShowWindow(Message& m)
    at System.Windows.Forms.Form.WndProc(Message& m)
    at DevExpress.XtraEditors.XtraForm.WndProc(Message& msg)
    at DevExpress.XtraBars.Ribbon.RibbonForm.WndProc(Message& msg)
    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: System.Reflection.ReflectionTypeLoadException

    And what does the LoaderExceptions property tell you? Have you examined it? Presumably it's a collection of exceptions that occurred when trying to load the specified types. My guess is that your database schema doesn't match your EF model but those loader exceptions should give you more specific information, which is why you were directed to them.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width