Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.
Help with exception "Unhandled Exception: System.ArgumentException: The array could not be created: The type initializer for 'ShoNS.Array.TypeToImplMapDense' threw an exception."

Domanda Help with exception "Unhandled Exception: System.ArgumentException: The array could not be created: The type initializer for 'ShoNS.Array.TypeToImplMapDense' threw an exception."

  • Friday, February 18, 2011 6:23 PM
     
     

    I am trying to create an xcopy installable utility that leverages some of the Sho libraries.  I find that when I run my program on a machine that has Sho properly installed it works fine but when I xcopy the Sho dll's along with my program to a different machine it repeatedly fails with this exception.  My deployment scenario precludes anything but xcopy install so this is something of a blocker.  Any advice would be appreciated:

    "Unhandled Exception: System.ArgumentException: The array could not be created: The type initializer for 'ShoNS.Array.TypeToImplMapDense' threw an exception.
       at ShoNS.Array.ArrayExceptionHelper.ThrowInnerCreateException(Exception e)
       at ShoNS.Array.ArrayBase`1..ctor(Int32 size0, Int32 size1)
       at ShoNS.Array.IntArray..ctor(Int32 size0, Int32 size1)"

All Replies

  • Monday, February 21, 2011 6:49 PM
    Moderator
     
     

    Hello,

    The Sho external API guide should help you on this issue: http://research.microsoft.com/en-us/projects/sho/shoexternalapis.aspx.

    From the "Code Setup" section from the above link:

    Because the ShoArray classes contain both managed and unmanaged code to achieve maximal computation speed, the array libraries depend on some satellite DLLs. In order for the managed libraries to resolve these references, you'll have to do one of the following:

    • [preferred method] Set the environment variable SHODIR to the parent of Sho's bin directory. Alternatively, you can set the variable SHOBINDIR to the bin directory directly. For instance, if you copied the bin directory from the Sho install to C:\libraries\Sho\bin, you should point SHODIR to C:\libraries\Sho. Note that you can set the variable programatically (ideally as soon as the app starts) via

      System.Environment.SetEnvironmentVariable("SHODIR",...)
    • Another option is to put your .exe into the Sho\bin directory, or equivalently copy the Sho\bin directory to the directory that contains your .exe.