Bug Report B204522
Visible to All Users

GridControl ShowPrintPreview error

created 14 years ago

To reproduce:

  1. Create new WinForms application (NET 4.0).
  2. Drop XtraGrid on Form1.
  3. Drop SimpleButton on Form1 and in "…Click" handler write:
        private void simpleButton1_Click(object sender, EventArgs e)
        {
          if (gridControl1.IsPrintingAvailable)
          {
            gridControl1.ShowPrintPreview();
          }
          else
          {
            MessageBox.Show("ERROR");
          }
        }
  4. Copy all needed redistributable assemblies into the target directory on target machine and click button.
  5. Everything works as expected.
    ---
  6. NOW, start the application from *NETWORK SHARE* and "ERROR" message box shows.
    ---
  7. If you change event handler to this:
            new XtraReport().ShowPreview(); // <-- here!
            gridControl1.ShowPrintPreview();
    …everything works as expected.
    It looks like XtraPrinting doesn't get properly initialized/loaded when called from GridControl from network share.
    Same goes for v2011 v1.6 - I believe it work properly before that…
    TIA,
    Dusan Pupis
Show previous comments (6)

    Like I said previously, following errors show only when running from network, not locally.
    In addition to the aforementioned PrintHelperBase.IsPrintingAvailable, which works,
    I played with code snippets from source you posted and came to some conclusions:
    ------------------------------
    1.
    var available = Assembly.Load(AssemblyInfo.SRAssemblyPrinting) != null;
    MessageBox.Show(available.ToString());
    …returns TRUE and preview consequentially works.
    ------------------------------
    2.
    var available = DevExpress.Data.Utils.AssemblyCache.LoadDXAssembly(AssemblyInfo.SRAssemblyPrinting) != null;
    MessageBox.Show(available.ToString());
    …return FALSE and preview DOES NOT work.
    ------------------------------
    3.
    var assemName = Assembly.GetExecutingAssembly().GetName();
    assemName.Name = AssemblyInfo.SRAssemblyPrinting;
    assemName.Version = new Version(AssemblyInfo.Version);
    var available = DevExpress.Data.Utils.AssemblyCache.Load(assemName) != null;
    MessageBox.Show(available.ToString());
    THROWS with:
    System.IO.FileLoadException: Could not load file or assembly 'DevExpress.XtraPrinting.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
    The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
    File name: 'DevExpress.XtraPrinting.v11.1, Version=11.1.7.0, Culture=neutral, PublicKeyToken=null'
       at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
       at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
       at DevExpress.Data.Utils.AssemblyCache.Load(AssemblyName assemName)
       at WindowsFormsApplication7.Form1.simpleButton3_Click(Object sender, EventArgs e) in w:\Infoteh2\WindowsFormsApplication7\WindowsFormsApplication7\Form1.cs:line 90
    ------------------------------
    4.
    var available = DevExpress.Data.Utils.AssemblyCache.LoadWithPartialName(AssemblyInfo.SRAssemblyPrinting) != null;
    MessageBox.Show(available.ToString());

    …returns TRUE and preview consequentially works.
    ------------------------------
    5.
    var available = DevExpress.Data.Utils.Helpers.LoadWithPartialName(AssemblyInfo.SRAssemblyPrinting + ", Version=" + AssemblyInfo.Version) != null;
    MessageBox.Show(available.ToString());
    …returns TRUE and preview consequentially works.
    ------------------------------
    So I guess the trouble lies within DevExpress.Data.Utils.AssemblyCache.LoadDXAssembly (even standard Assembly.Load WORKS).
    Please find demo project attached (executable in bin/debug).
    This is getting kind of urgent, so I'd appreciate your prompt reply.
    TIA,
    Dusan

    DevExpress Support Team 14 years ago

      Hi Dusan,
      I've reproduced the problem using your project. It was necessary to also remove assemblies from the GAC. I have passed this issue to our R&D and we will try to fix it as soon as possible.
      Thanks,
      Plato

      DevExpress Support Team 14 years ago

        Hi Dusan,
        Please accept my sincere apologies for the delay in responding.
        Our developers suggest that you add the loadFromRemoteSources option to the configuration file of your application to resolve this issue. Please review the <loadFromRemoteSources> Element article for additional information. Thanks for your feedback in advance.
        Thanks,
        Elliot

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.