locked
Custom control load issue in VS 2010 RRS feed

  • Question

  • We have a custom control named HostStatusControl. When we are placing (design time) the control to a form, we are getting the following error message. ICEIOBridge is one of the CLI libraries referred by the control. If we remove ICEIOBridge, the error message will be shown with another CLI library referred by the control.

    What could be the reason for the issue?

    ---------------------------
    Microsoft Visual Studio
    ---------------------------
    Failed to create component 'HostStatusControl'.  The error message follows:
    
    'System.IO.FileNotFoundException: Could not load file or assembly 'ICEIOBridge, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
    
    File name: 'ICEIOBridge, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null'
    
       at NeST.ICE.UI.TitlePanel.HostStatusControl..ctor()
    
    
    
    WRN: Assembly binding logging is turned OFF.
    
    To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
    
    Note: There is some performance penalty associated with assembly bind failure logging.
    
    To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
    
    '
    ---------------------------
    OK   
    ---------------------------

    We have debug the designer and got the following logs

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
    Running under executable  C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe
    --- A detailed error log follows. 

    === Pre-bind state information ===
    LOG: User = aaa
    LOG: DisplayName = ICEIOBridge, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null
    (Fully-specified)
    LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/
    LOG: Initial PrivatePath = NULL
    Calling assembly : (Unknown).
    ===
    LOG: This bind starts in default load context.
    LOG: Using application configuration file: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.Config
    LOG: Using host configuration file: 
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
    LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
    LOG: The same bind was seen before, and was failed with hr = 0x80070002.


    Tuesday, December 4, 2012 9:52 AM

Answers

  • Your custom assembly (ICEIOBridge must be referenced in the project so the designer can load it.  Additionally if that assembly has any dependencies then they might also need to be referenced.

    Michael Taylor - 12/4/2012
    http://msmvps.com/blogs/p3net

    Tuesday, December 4, 2012 2:42 PM
    Moderator
  • It depends.  In general if you add a reference to a project then VS will automatically add the dependent assemblies as well but this only works if there is an actual binding in the metadata (which isn't always the case).  Additionally it won't necessarily pick off deep dependencies nor will it pick off dependencies loaded via other means such as reflection.

    The error that is being generated indicates that one the aforementioned dependency cannot be found.  If the control is defined in a separate project then VS should be able to find the dependency correctly.  If it is a binary reference then the hosting project will likely need a reference as well.  This will ensure the assembly is in the hosting project's output directory.

    The designer will ultimately use reflection to load everything since it doesn't know in advance about your controls. 

    Michael Taylor - 12/6/2012
    http://msmvps.com/blogs/p3net

    • Proposed as answer by Mike_999 Monday, December 10, 2012 4:53 AM
    • Marked as answer by Lisa ZhuModerator Thursday, December 13, 2012 7:50 AM
    Thursday, December 6, 2012 3:52 PM
    Moderator

All replies

  • We have a custom control named HostStatusControl. When we are placing (design time) the control to a form, we are getting the following error message. ICEIOBridge is one of the CLI libraries referred by the control. If we remove ICEIOBridge, the error message will be shown with another CLI library referred by the control.

    What could be the reason for the issue?

    ---------------------------
    Microsoft Visual Studio
    ---------------------------
    Failed to create component 'HostStatusControl'.  The error message follows:
    
    'System.IO.FileNotFoundException: Could not load file or assembly 'ICEIOBridge, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
    
    File name: 'ICEIOBridge, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null'
    
       at NeST.ICE.UI.TitlePanel.HostStatusControl..ctor()
    
    
    
    WRN: Assembly binding logging is turned OFF.
    
    To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
    
    Note: There is some performance penalty associated with assembly bind failure logging.
    
    To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
    
    '
    ---------------------------
    OK   
    ---------------------------

    We have debug the designer and got the following fusion logs

    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
    Running under executable  C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe
    --- A detailed error log follows. 

    === Pre-bind state information ===
    LOG: User = aaa
    LOG: DisplayName = ICEIOBridge, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null
    (Fully-specified)
    LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/
    LOG: Initial PrivatePath = NULL
    Calling assembly : (Unknown).
    ===
    LOG: This bind starts in default load context.
    LOG: Using application configuration file: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.Config
    LOG: Using host configuration file: 
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
    LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
    LOG: The same bind was seen before, and was failed with hr = 0x80070002.



    Tuesday, December 4, 2012 9:54 AM
  • Your custom assembly (ICEIOBridge must be referenced in the project so the designer can load it.  Additionally if that assembly has any dependencies then they might also need to be referenced.

    Michael Taylor - 12/4/2012
    http://msmvps.com/blogs/p3net

    Tuesday, December 4, 2012 2:42 PM
    Moderator
  • Thanks Michael , this means dependencies of the dpency should be refered in client project?. Is these assemblies are loaded via reflection?
    
    
    Thursday, December 6, 2012 12:14 PM
  • It depends.  In general if you add a reference to a project then VS will automatically add the dependent assemblies as well but this only works if there is an actual binding in the metadata (which isn't always the case).  Additionally it won't necessarily pick off deep dependencies nor will it pick off dependencies loaded via other means such as reflection.

    The error that is being generated indicates that one the aforementioned dependency cannot be found.  If the control is defined in a separate project then VS should be able to find the dependency correctly.  If it is a binary reference then the hosting project will likely need a reference as well.  This will ensure the assembly is in the hosting project's output directory.

    The designer will ultimately use reflection to load everything since it doesn't know in advance about your controls. 

    Michael Taylor - 12/6/2012
    http://msmvps.com/blogs/p3net

    • Proposed as answer by Mike_999 Monday, December 10, 2012 4:53 AM
    • Marked as answer by Lisa ZhuModerator Thursday, December 13, 2012 7:50 AM
    Thursday, December 6, 2012 3:52 PM
    Moderator
  • Actual Issue : Project was migrated from 2008 version with lot of legacy dependency. I believe it was not done properly. When i built 2010 version of project with "Allow Unsafe code"  it worked.
    
    Friday, December 14, 2012 12:15 PM