Skip to content
DataMiner DoJo

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages
Search in posts
Search in pages
Log in
Menu
  • Updates & Insights
  • Questions
  • Learning
    • E-learning Courses
    • Empower Replay: Limited Edition
    • Tutorials
    • Open Classroom Training
    • Certification
      • DataMiner Fundamentals
      • DataMiner Configurator
      • DataMiner Automation
      • Scripts & Connectors Developer: HTTP Basics
      • Scripts & Connectors Developer: SNMP Basics
      • Visual Overview – Level 1
      • Verify a certificate
    • Video Library
    • Books We Like
    • >> Go to DataMiner Docs
  • Expert Center
    • Solutions & Use Cases
      • Solutions
      • Use Case Library
    • Markets & Industries
      • Media production
      • Government & defense
      • Content distribution
      • Service providers
      • Partners
      • OSS/BSS
    • Agile
      • Agile Webspace
      • Everything Agile
        • The Agile Manifesto
        • Best Practices
        • Retro Recipes
      • Methodologies
        • The Scrum Framework
        • Kanban
        • Extreme Programming
      • Roles
        • The Product Owner
        • The Agile Coach
        • The Quality & UX Coach (QX)
    • DataMiner DevOps Professional Program
      • About the DevOps Program
      • DataMiner DevOps Support
  • Downloads
  • More
    • DataMiner Releases & Updates
    • Feature Suggestions
    • Climb the leaderboard!
    • Swag Shop
    • Contact
    • Global Feedback Survey
  • PARTNERS
    • All Partners
    • Technology Partners
    • Strategic Partner Program
    • Deal Registration
  • >> Go to dataminer.services

Automation script NuGet incompatibilities

Solved1.36K views4th January 2024automation scipt chatbot NuGet
5
Joey Vanhalst [SLC] [DevOps Advocate]1.80K 5th June 2023 0 Comments

Hi,

I'm working on a custom chat bot command that retrieves the last BPA results. See repo here: SkylineCommunications/SLC-AS-ChatOps-BPA (github.com).

The script uses the following NuGet packages:

which results in the following DLL references when deploying the script on the agent:

The problem I'm facing is that the "AdaptiveCards" NuGet does not seem to be compatible with the latest NewtonSoft NuGet (13.0.2 in this case) which is (from what I understood) referenced in the "Skyline.DataMiner.Core.DataMinerSystem.Automation" NuGet. If I manually change the reference for the NewtonSoft NuGet to version 11.0.2 (C:\Skyline DataMiner\ProtocolScripts\DllImport\newtonsoft.json\11.0.2\lib\net45\Newtonsoft.Json.dll), then my command is working as expected.

Is there anyway to enforce the use of that specific NuGet version so I don't have to manually change this after deploying my script?

Jordy Ampe [SLC] [DevOps Enabler] Answered question 4th January 2024

3 Answers

  • Active
  • Voted
  • Newest
  • Oldest
2
Tom Waterbley [SLC] [DevOps Catalyst]8.89K Posted 7th June 2023 2 Comments

After a long investigation it turns out that it looks like the [JsonObject] on top of the AdaptiveTypedElement class is not being detected. The attribute defines that classes need to be serialized as object, even though as array might be more appropriate. Because the attribute is not detected, some classes are being serialized as array, which is causing the NotImplementedException.

This is related to how DataMiner is loading DLLs into memory. What happens is the following:

  1. When the AdaptiveCards DLL is loaded, it uses the attributes from Newtonsoft11, specifically the AdaptiveTypedElement with Newtonsoft11.JsonObjectAttribute.
  2. Newtonsoft13 is used for serialization and looks for the NewtonSoft13.JsonObjectAttribute above classes. Since this attribute is not available (because the AdaptiveCards dll relies on the older version, Newtonsoft11), Newtonsoft13 behaves as if this attribute does not exist. Serialization continues as if theJsonObjectAttribute is not specified above the AdaptiveTypedElement class.

As a workaround you can force to serialize as object instead of array, by using a custom resolver:

private static void Test()
{
var adaptiveCardBody = new List<AdaptiveElement>()
{
new AdaptiveContainer { new AdaptiveFactSet(), }
};

var settings = new JsonSerializerSettings()
{
ContractResolver = new CustomContractResolver(),
};

var json = JsonConvert.SerializeObject(adaptiveCardBody, settings);

}
}

public class CustomContractResolver : DefaultContractResolver
{
public override JsonContract ResolveContract(Type objectType)
{
var contract = base.ResolveContract(objectType);

if (typeof(AdaptiveCollectionElement).IsAssignableFrom(contract.UnderlyingType))
{
contract = CreateObjectContract(objectType);
}

return contract;
}
}

Marieke Goethals [SLC] [DevOps Catalyst] Selected answer as best 4th July 2023
Avatar photo
Jan Staelens [SLC] [DevOps Advocate] commented 7th June 2023

We are in the progress of designing several POC’s that will change the architecture of how DataMiner loads up assemblies to address problems with assembly version conflicts and inconsistent behavior between a normal program/visual studio and the runtime of the code on a DataMiner.

Without going too deep into it. The root cause of most of these issues is the lack of bindingredirects in DataMiner for automationscripts and connectors. It’s that lack we’ll be looking to fix. We’ve got a few options but they all consist of running more than one SLScripting process or similar which will need good scaling tests.

Joey Vanhalst [SLC] [DevOps Advocate] commented 7th June 2023

Thanks Tom! Even though that indeed solves the issues with the serialization (exception no longer thrown). It does result in a different string which causes problems when it is being deserialized to show the AdaptiveCard in Teams.

You are viewing 1 out of 3 answers, click here to view all answers.
Please login to be able to comment or post an answer.

My DevOps rank

DevOps Members get more insights on their profile page.

My user earnings

0 Dojo credits

Spend your credits in our swag shop.

0 Reputation points

Boost your reputation, climb the leaderboard.

Promo banner DataMiner DevOps Professiona Program
DataMiner Integration Studio (DIS)
Empower Katas
Privacy Policy • Terms & Conditions • Contact

© 2025 Skyline Communications. All rights reserved.

DOJO Q&A widget

Can't find what you need?

? Explore the Q&A DataMiner Docs

[ Placeholder content for popup link ] WordPress Download Manager - Best Download Management Plugin