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

Preprocessor #defineon a C# automation script

Solved601 views19th July 2023
2
Henri Martins [DevOps Advocate]626 28th June 2023 0 Comments

Hi.

I want to use preprocessor instruction “#define DEBUG” as first instruction on a C# automation script

But when I clic validate, I’ve got one error: “Cannot define/undefine preprocessor symbols after token in file”.

I don’t understand what is the problem. What is the token, it’s talking about?

Better how could I resolve it without running allways instructions like I’ve seen in others questions on DOJO.

Thanks

Marieke Goethals [SLC] [DevOps Catalyst] Selected answer as best 19th July 2023

2 Answers

  • Active
  • Voted
  • Newest
  • Oldest
8
Tom Van Bruaene [SLC] [DevOps Member]758 Posted 28th June 2023 0 Comments

See: Adding C# code to an Automation script | DataMiner Docs
If you don’t define a Script class, dataminer will make that class for you and wrap your code in it.
#define is not allowed to be in a class in C# so it will give that error.

So if you want to work with defines you should write your own script class and run your code in the Run method.

Marieke Goethals [SLC] [DevOps Catalyst] Selected answer as best 19th July 2023
4
Ive Herreman [SLC] [DevOps Enabler]13.59K Posted 28th June 2023 2 Comments

Hi Henri,

You must make sure the #define DEBUG is the very first line of code in your script.

e.g. the code below validates just fine:

Ive Herreman [SLC] [DevOps Enabler] Posted new comment 28th June 2023
Henri Martins [DevOps Advocate] commented 28th June 2023

The “#define DEBUG” is on top of script, on first line.
The error message is always here.

Ive Herreman [SLC] [DevOps Enabler] commented 28th June 2023

Would you be able to share a screenshot of your automation script (or a link to a Git repo)?

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