Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Nickel Contributor
Posts: 46
Registered: ‎08-17-2009
Accepted Solution

.NET Extension on SLX 8.0

I've got a Framework 2.0 .NET extension on 7.5.4 that uses the Crystal runtime to run a report.  The Crystal runtime is only availalbe on Framework 2.0.  From what I can tell, under SLX 8.0, .NET Extensions must be upgraded to Framework 4.0.  First, has anyone been able to run a FW 2.0 dll as a SLX 8.0 .NET Extension?  Second, I've found many posts on how to load a FW 2.0 dll from a FW 4.0 dll, but it doesn't seem to work when called from SLX.  It does work as a stand-alone app.

Nickel Contributor
Posts: 46
Registered: ‎08-17-2009

Re: .NET Extension on SLX 8.0

I should note that there is a Crystal Runtime for VS2010 and they claim it is for FW 4.0, but if you look at the assemblies, they are actually FW 2.0.  The common solution around the web is to add the following to app.config:

 

<startupuseLegacyV2RuntimeActivationPolicy="true">

             <supportedRuntimeversion="v2.0.50727"/>

</startup>

 

This however does not work for a SLX .NET extension.

Nickel Contributor
Posts: 46
Registered: ‎08-17-2009

Re: .NET Extension on SLX 8.0

Thanks to Brian Thews for providing the final step in all of this.  Basically, it appears that the app.config call to the V2 Legacy Runtime is ignored when called from SLX (I think likely because SLX itself is calling from FW 4.0 and automatically loads the .NET Extension with FW 4.0).  Anyway, the solution is to set the V2 Legacy Runtime at runtime using the following:

 

   

publicstaticclassRuntimePolicyHelper

    {

       

public static bool LegacyV2RuntimeEnabledSuccessfully { get; private set; }

       

static RuntimePolicyHelper()

        {

           

ICLRRuntimeInfo clrRuntimeInfo =

                (

ICLRRuntimeInfo)RuntimeEnvironment.GetRuntimeInterfaceAsObject(

                   

Guid.Empty,

                   

typeof(ICLRRuntimeInfo).GUID);

           

try

            {

                clrRuntimeInfo.BindAsLegacyV2Runtime();

                LegacyV2RuntimeEnabledSuccessfully =

true;

            }

           

catch (COMException)

            {

               

// This occurs with an HRESULT meaning

               

// "A different runtime was already bound to the legacy CLR version 2 activation policy."

                LegacyV2RuntimeEnabledSuccessfully =

false;

            }

        }

        [

ComImport]

        [

InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]

        [

Guid("BD39D1D2-BA2F-486A-89B0-B4B0CB466891")]

       

privateinterfaceICLRRuntimeInfo

        {

           

void xGetVersionString();

           

void xGetRuntimeDirectory();

           

void xIsLoaded();

           

void xIsLoadable();

           

void xLoadErrorString();

           

void xLoadLibrary();

           

void xGetProcAddress();

           

void xGetInterface();

           

void xSetDefaultStartupFlags();

           

void xGetDefaultStartupFlags();

            [

MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]

           

void BindAsLegacyV2Runtime();

        }

    }

 

and then create your object after calling:

 

RuntimePolicyHelper

.LegacyV2RuntimeEnabledSuccessfully

Moderator
Posts: 440
Registered: ‎05-07-2008

Re: .NET Extension on SLX 8.0

FYI, Saleslogix 8.1 will be using the Crystal Runtime for VS2010 as it's main API for reporting.

John Perona

Director, Infor CRM Development

Infor CRM

Infor CRM