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

Unit Test – BadImageFormatExceptiuon – Could not load file or assembly ‘SLManagedScripting’

Solved566 views23rd July 2024Unit Test
1
Fenta Alemahu [SLC] [DevOps Enabler]1.10K 23rd July 2024 0 Comments

Hi all,

We have an existing protocol which has unit tests. If the platform target of the unit test project is set to x86, running the tests in Visual Studio succeeds. If the platform target is set to x64 or Any CPU, running the tests in VS fails. In both scenarios, when I push the protocol solution to the CI/CD pipeline, it fails and gives the same exception as it gives in VS when the platform target is set to x64 or Any CPU. The error message is the one shown below.

Error message in VS

Error message in the CI/CD pipeline

How is it possible to fix such issues?

Fenta Alemahu [SLC] [DevOps Enabler] Selected answer as best 23rd July 2024

2 Answers

  • Active
  • Voted
  • Newest
  • Oldest
1
Matthias Declerck [SLC] [DevOps Advocate]2.75K Posted 23rd July 2024 0 Comments

Hi Fenta,

The exception you're encountering, `BadImageFormatException`, occurs when the runtime tries to load an assembly with an invalid format (e.g., 32-bit assembly loaded in a 64-bit process). You need to verify  that your test project's platform target aligns with the architecture of the referenced assemblies (e.g., x86 for 32-bit assemblies, x64 for 64-bit assemblies).
When you set the Platform Target to `x86`, your unit tests compile specifically for 32-bit (x86) architecture. If you choose `x64` or `AnyCPU`, the compiled code is intended for 64-bit architecture or any available architecture, respectively.

What you need to do is ensure consistency with your protocol library and referenced assemblies.
The answer of João is a nice approach.

I hope this will help you further.

Matthias Declerck [SLC] [DevOps Advocate] Edited answer 23rd July 2024
You are viewing 1 out of 2 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