none
Understanding NXCompat and Publishing RRS feed

  • Question

  • Hope this is the right forum for this...have run into a problem that I cannot seem to get around due to my very limited experience w/ the Visual Studio tool and .NET in general.

    I have a utility FOO which has a reference to BAR (I love those examples) and BAR has an Interop attached to it for SACLIENT.DLL which is the DLL needed to call routines to monkey around w/ Mercury Interactive's Quality Center suite.

    Everything about the setup worked like a charm until BAR got upgraded to .NET and that resulted in some errors that point to the DEP and NXCompat.  So, after tons of reading stuff that I don't fully understand I came across the use of EDITBIN.  After making the requisite changes to my path I put the following line in the Post Compile build options for BAR:

    editbin.exe /NXCOMPAT:NO "BAR.dll"                                                                       editbin.exe /NXCOMPAT:NO "SAClient.dll"

    The build for BAR works and then I found I had to do the same thing to FOO (no idea why) but FOO now has:

    editbin.exe /NXCOMPAT:NO "FOO.exe"                                                       editbin.exe /NXCOMPAT:NO "BAR.dll"                                                                              editbin.exe /NXCOMPAT:NO "SAClient.dll"

    So, I build BAR and save it.  Went to the references page for FOO and removed and reattached BAR.  Build and save.

    Now, when I execute FOO (by going to the BIN\RELEASE directory) put in the requisite parameters for a Quality Center user and hit Search...it works.  And that's what I want.

    Then, I publish whole mess and I'm right back at the original error message :

    Unable to Log into Quality Center : The type initializer for 'BAR.QualityCenterAdmin' threw an exception.System.BadImageFormatException: Retrieving the COM class factory for component with CLSID <very long number here> failed due to the following error: 800703e6 at BAR.QualityCenterAdmin..cctor()

    Is there something I need to do at the Publish step?  What have I missed?  I think I'm very close but simply don't know enough about the environment to understand it.  Any help would be appreciated.

    Wednesday, May 5, 2010 3:26 PM

All replies

  • Do you have a small repro (using command line compilers and editbin) outside of the host?

    -Karel

    Thursday, May 6, 2010 8:05 AM
    Moderator
  • I'm not entirely sure what you mean by that.  If you are referring doing the compilation from a DOS cmd window...then yes, I can do that - and have - as far as using the editbin command. 

    The problem only occurs if I Publish the solution.  However, I have only tried Publishing within the toolset, if there is a command line that can be used to the Publish then I don't know what it is.  However, I'd be surprised if it did anything different.

    My environment is Vista Enterprise (32-bit) w/ DoD Standard Desktop v2.1, AMD Phenom 2.3 Ghz w/ 4GB RAM, Visual Studio Pro 2008 v 9.0.30729.1 SP w/ .NET Framework 3.5 SP1.  The utilities we're creating are in VB2008 and there are numerous VS2008 hotfixes installed along w/ an update per KB972221

    Thursday, May 6, 2010 3:03 PM
  • I am not familiar with Publishing solutions. Is that a command in VS? (Maybe ClickOnce support?) Can you post a link to documentation on MSDN? (or add step-by-step repro for publishing solution - that could help too)

    (BTW: If it is VS command, I will move this thread to appropriate VS forum)

    Thursday, May 6, 2010 4:43 PM
    Moderator
  • I'm not sure I would call it a command per se...there may be one at the command line.  All I do is open the project,  make whatever changes I may need to make and save the project.  To compile I simply select Build followed by Build <project name> and I save all the files.  Then, to publish the utility, I select Build followed by Publish <project name>.
    Wednesday, May 12, 2010 4:56 PM
  • OK it is a menu item in VS - described e.g. here. Is this part of ASP.NET project? (It sounds like it is)

    And one step back:
    0x800703e6 is "Invalid access to memory location." Are you sure it is caused by the NXCOMPAT flag? Why do you think that changing NSCOMPAT flag will help you? (Did you read it on internet?)

    Also when you publish 'the whole mess', how do you execute it? Where is the error dislayed? (is it web page, error dialog, exception in some log)

    -Karel

    Wednesday, May 12, 2010 7:19 PM
    Moderator
  • The error started when we updated the DLL used to call SDK functions for StarTeam, Caliber and Quality Center.  The developer who owns the DLL changed it from a COM object to the .NET 'flavor'.  Everything is in Visual Basic.

    Research of the specific error message when doing a Quality Center action is what pointed us at the NXCompat flag which further pointed us at the DEP issues in Windows.  So, yes...we read it on the Internet (and it's everywhere).

    As for after publishing the first thing is to run the setup package which installs the utility in the Start Menu....OR....if you have already installed a previous version then clicking the icon will check for a newer version first and install it if needed.  The error gets displayed in a standard modal dialog window...I believe it's captured within a TRY statement and we simply display the error message and/or the inner exception message...which points us back to the Internet findings via Google (I love Google).

    Note that if I simply BUILD the project and STOP....then clicking the executable directly runs the tools and everything runs as expected.  It's only when I publish the darn thing that everything goes wonky....a technical term for FUBAR.   ;-)

    Hope that clears things up.....

    Wednesday, May 12, 2010 8:54 PM
  • Publish takes its exe from a different directory than debug.  There are two sibling directories obj and bin.  Make sure you editbin both exe files.
    Thursday, May 26, 2011 7:36 PM