Options

DotNet DataType Unable to create Instance

Hello Guys, I created a DLL using C# with .Net framework 4.0 and I have also deployed it in the add-ins folder on both client and server folder. However, it still prompts me the message "Cannot create an instance of the following .Net Framework. . ." (Please see the image). What am I missing? I am using Microsoft Dynamics NAV 2013 R2.

This is working fine when I change the DotNet datatype's property RunOnClient to True, but this is asking to "allow the extension. . ." for every session. I wanted to just run this on server only because I am using it also in the Job Queue. Please help.

Looking forward for your response. :smile:

Heres my C# and C/AL Code:

C#:
[Serializable]
public class Processor: ISerializable
{
[NonSerialized]
string postData;
public string PostData
{
get { return postData; }
set { postData = value; }
}
public Processor()
{
PostData = string.Empty;
}

public static string testMessage()
{
return "test";
}

public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue(postData, this.PostData);
}

public List<MembershipCard> BlockedMembershipCardList(string serviceUrl)
{
Bridge bridge = new Bridge(serviceUrl);
return bridge.GetBlockedMembershipCards();
}

public DataTable BlockedMembershipCardDataTable(string serviceUrl)
{
Bridge bridge = new Bridge(serviceUrl);
DataTable a = bridge.GetBlockedMembershipCardsAsDatatable();
return bridge.GetBlockedMembershipCardsAsDatatable();
}

public MembershipCard MemberShipInformation(string serviceUrl, string cardNumber)
{
Bridge bridge = new Bridge(serviceUrl);
return bridge.GetMembershipCard(cardNumber);
}

public MembershipCard PostTransactionsToWeb(string serviceurl, string _data)
{

Bridge bridge = new Bridge(serviceurl);
return bridge.PushTransactionToWeb(_data.TrimEnd('&').Replace(@\r\n, " ").Replace(" ", "%20"));
}

public MembershipCard PostTransactionsToWeb(string serviceurl)
{
Bridge bridge = new Bridge(serviceurl);
return bridge.PushTransactionToWeb(PostData.TrimEnd('&').Replace(@\r\n, " ").Replace(" ", "%20"));
}

public Status ValidateCouponCard(string serviceUrl, string memberCard, string couponCard)
{
Bridge bridge = new Bridge(serviceUrl);
return bridge.ValidateCouponCard(memberCard,couponCard);
}

public string md5(string rawString)
{
Bridge b = new Bridge();
return b.StringToMd5(rawString);
}

public bool CheckConnectivity(string url)
{
try
{
using (var client = new WebClient())
using (var stream = client.OpenRead(url))
{
return true;
}
}
catch
{
return false;
}
}
}

C/AL:
LoyaltyIntegration := LoyaltyIntegration.Processor;
blockedCardData := LoyaltyIntegration.BlockedMembershipCardDataTable(PosFuncProfile."LOY Web Service Uri");
recLoyBlockedCards.INIT;
recLoyBlockedCards.RESET();

recLoyBlockedCards.DELETEALL;
FOR rowCtr := 0 TO blockedCardData.Rows.Count - 1 DO BEGIN
recLoyBlockedCards."Card Number" := blockedCardData.Rows.Item(rowCtr).Item(0);
recLoyBlockedCards."Block Type" := blockedCardData.Rows.Item(rowCtr).Item(1);
recLoyBlockedCards.INSERT;
END;

The error occurs upon Initializing the LoyaltyIntegration;

Best Answers

Answers

  • Options
    coheedramoscoheedramos Member Posts: 6
    Fuck!!! it works like a fucking charm! you holy grace from above!

    Just to add. . . Does mean that I have to deploy a 2 separate build of my dll x86 and 64bit?
  • Options
    coheedramoscoheedramos Member Posts: 6
    Thank you man!
Sign In or Register to comment.