none
Help vs2010 ... bindingfailure detected ... expression_host failed to load RRS feed

  • Question

  • upgraded to vs 2010 pro from vs 2008 pro. rdlc files are embedded.

    note that i've commented out the security stuff ... i added it based on what i found on other blogs

    but it made no difference as coded -- tried both my assembly and this expression_host to no avail.

     i've read that expression_host is created dynamically, so this seems out of direct control?

    here is a sample, and i've pasted the error report below the code

    Private Sub ppt101()
    
    
    
     Dim objbs As BindingSource = Nothing
    
     Dim dstbs As BindingSource = Nothing
    
     Dim objrds As ReportDataSource = Nothing
    
     Dim dstrds As ReportDataSource = Nothing
    
    
    
     Dim rdr As OleDbDataReader = Nothing
    
     Dim sw As New List(Of Contaminant)
    
    
    
     Try
    
     ' φ create datasource linked to source properties for uptable 
    
     objrds = New ReportDataSource
    
     objrds.Name = "SWAPui_SWSource" ' φ change here
    
     objbs = New BindingSource
    
     objrds.Value = objbs
    
     objbs.DataSource = _ssrc ' φ change here
    
     ' φ create datasource linked to arraylist of ratings for dntable
    
     dstrds = New ReportDataSource
    
     dstrds.Name = "SWAPui_Contaminant"
    
     dstbs = New BindingSource
    
     dstrds.Value = dstbs
    
     dstbs.DataSource = sw
    
     With pRV
    
     .SuspendLayout()
    
     .TabIndex = 0
    
     .ShowDocumentMapButton = False
    
     .ShowFindControls = False
    
     .Reset()
    
     .LocalReport.DataSources.Clear()
    
     ' see this: http://blogs.msdn.com/b/brianhartman/archive/2010/02/18/expression-evaluation-in-local-mode.aspx
    
     ' for explanation of security issues which require this hoop-jumping
    
     'Dim pms As Security.PermissionSet = New Security.PermissionSet(Security.Permissions.PermissionState.None)
    
     'pms.AddPermission(New Security.Permissions.FileIOPermission(Security.Permissions.PermissionState.Unrestricted))
    
     'pms.AddPermission(New Security.Permissions.SecurityPermission(Security.Permissions.SecurityPermissionFlag.Execution))
    
     '.LocalReport.SetBasePermissionsForSandboxAppDomain(pms)
    
     'Dim asm As Reflection.Assembly = Reflection.Assembly.Load("expression_host_70bb1435c9d14686bd10bac35c5ab6bd, Version=11.2.30319.1, Culture=neutral, PublicKeyToken=null")
    
     'Dim asmn As Reflection.AssemblyName = asm.GetName()
    
     '.LocalReport.AddFullTrustModuleInSandboxAppDomain( _
    
     ' New System.Security.Policy.StrongName( _
    
     ' New Security.Permissions.StrongNamePublicKeyBlob( _
    
     ' asmn.GetPublicKeyToken), _
    
     ' asmn.Name, asmn.Version))
    .ProcessingMode = ProcessingMode.Local
    
     .LocalReport.ReportEmbeddedResource = "SWAPDSS.prpt101.rdlc"
    
     .LocalReport.DataSources.Add(objrds)
    
     .LocalReport.DataSources.Add(dstrds)
    
     ' φ causes the current report in the Report Viewer to be processed and rendered.
    
     .RefreshReport()
    
     .Visible = True
    
     .ResumeLayout()
    
     End With
    
    Catch ex As Exception
    
     Return
    
     Finally
    
     If rdr IsNot Nothing Then
    
     rdr.Dispose()
    
     rdr = Nothing
    
     End If
    
    
    
    End Try

    here is the error produced in debug mode

    BindingFailure was detected
    Message: The assembly with display name 'expression_host_1db46cb70c574299b02ff1d6de5f2d49' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'expression_host_1db46cb70c574299b02ff1d6de5f2d49, Version=11.2.30319.1, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
    File name: 'expression_host_1db46cb70c574299b02ff1d6de5f2d49, Version=11.2.30319.1, Culture=neutral, PublicKeyToken=null'

    === Pre-bind state information ===
    LOG: User = Swapinator\Dad
    LOG: DisplayName = expression_host_1db46cb70c574299b02ff1d6de5f2d49, Version=11.2.30319.1, Culture=neutral, PublicKeyToken=null
     (Fully-specified)
    LOG: Appbase = file:///K:/Solutions/Build3a/SWAPdss/bin/Debug/
    LOG: Initial PrivatePath = NULL
    Calling assembly : (Unknown).
    ===
    LOG: This bind starts in default load context.
    LOG: Using application configuration file: K:\Solutions\Build3a\SWAPdss\bin\Debug\SWAPDSS.vshost.exe.Config
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
    LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
    LOG: Attempting download of new URL file:///K:/Solutions/Build3a/SWAPdss/bin/Debug/expression_host_1db46cb70c574299b02ff1d6de5f2d49.DLL.
    LOG: Attempting download of new URL file:///K:/Solutions/Build3a/SWAPdss/bin/Debug/expression_host_1db46cb70c574299b02ff1d6de5f2d49/expression_host_1db46cb70c574299b02ff1d6de5f2d49.DLL.
    LOG: Attempting download of new URL file:///K:/Solutions/Build3a/SWAPdss/bin/Debug/expression_host_1db46cb70c574299b02ff1d6de5f2d49.EXE.
    LOG: Attempting download of new URL file:///K:/Solutions/Build3a/SWAPdss/bin/Debug/expression_host_1db46cb70c574299b02ff1d6de5f2d49/expression_host_1db46cb70c574299b02ff1d6de5f2d49.EXE.

     

    • Edited by rlulery Tuesday, July 13, 2010 3:14 PM clarification
    Saturday, July 10, 2010 1:48 PM

All replies

  • Did you happen to find a solution for this?

    Monday, March 7, 2011 2:19 PM
  • I'm having the exact same problem since I upgraded from VS 2005 to VS 2010 my project with local report viewer control with embedded .rdlc file.  

    Program crash in the following code:

     

            //get the rendered PDF binary data
    
            byte[] data = local_report.Render(export_format_str, null,  out mimeType, out encoding, out extension, out streams, out warnings);
    
    
    When I uncheck the debug assistant exceptions the problem doesn't show. However, when I debug from VS 2005 from unmanaged C++, I get a EEFileNotFoundException, and as a result it make my application crash.  The application crash only occurs when debugging.

    When I start my application directly, there is no problem since I included the following code in my form destructor:

    this.reportViewer_.LocalReport.ReleaseSandboxAppDomain();

    I trie to set Security attributes, but as rlulery said, it didn't help.

     

    There is a real problem here since the debugger make the application crash because it supposely get a notification from the managed code that it handles poorly.

     

    For me the the only satisfying solution would be to go back to VS2005, but I would go back to the "very large .pdf size" problem, which I was trying to avoid by converting to VS2010. This is frustrating!

     

     

    Friday, August 5, 2011 7:26 PM
  • Hi Pierre,

    I don't have an answer but be sure to check:

    http://blogs.msdn.com/b/brianhartman/

    http://gotreportviewer.com/

    As you may find something helpful there.

    Saturday, August 6, 2011 2:19 PM
  • Thanks Perter for the help! The blog did help to get some background information about the changes in reportviewer 2010. The following post was usefull:

    http://blogs.msdn.com/b/brianhartman/archive/2010/02/18/expression-evaluation-in-local-mode.aspx

     

    I understood that the problem came from expression evaluation in the report (like visibility attributes or other expressions), it seems that the library that evaluates expression could not load properly (expression host), may because of the new security model in framework 4.0 (by the way, using 3.5 version didn't solve the problem). In local report mode, this library is generated dynamically in RAM.  

    I managed to find a workaround by enabling the following line in the app.config file, no other code was necessary:

    <?xml version="1.0"?>
    
    <configuration>
    
    <runtime>
    
         <legacyCasPolicy enabled="true" />
    
       </runtime>
    
    <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/></startup></configuration>
    
    

    I tried to support the security in the .Net 4.0 way, but it didn't work. If someone finds a code only solution, let me know.

     

    Tuesday, August 9, 2011 3:47 PM