Questions tagged [codedom]

CodeDOM is a framework which can be used to create an (abstract) expression tree representing real code structures (for example, classes, statements, etc.) in a language-independent way. This means if you construct an expression tree, you can use (or write) code generators to output the same logical structure in multiple different target languages. Language generators exist for VB.NET, C#, and JScript, but you can also create your own.

What is CodeDOM?

CodeDOM is a .NET library from Microsoft which:

  • Gives you a way to represent source code as expression objects

  • Provides some pre-built generators to translate the expressions into raw source code

  • Makes it easy to compile the generated source to executable code

Here is an excerpt from MSDN describing CodeDOM:

The CodeDOM provides types that represent many common types of source code elements. You can design a program that builds a source code model using CodeDOM elements to assemble an object graph. This object graph can be rendered as source code using a CodeDOM code generator for a supported programming language. The CodeDOM can also be used to compile source code into a binary assembly.

Some common uses for the CodeDOM include:

  • Templated code generation: generating code for ASP.NET, XML Web services client proxies, code wizards, designers, or other code-emitting mechanisms.

  • Dynamic compilation: supporting code compilation in single or multiple languages.

If you look into CodeDOM you will probably encounter a lot about abstract syntax trees (ASTs). This is the technical term for an expression tree in this context (originating from the way code generators, parsers, and compilers are written). If you plan to get into CodeDOM it helps to understand the basic concept; Wikipedia has a reasonable article on the subject.

What type of question should use this tag?

Questions should use this tag if they relate to the use, comprehension, or interaction with the CodeDOM library. It could also be used on questions relating to generation of code using a document object model (DOM) strategy similar to that provided by the Microsoft CodeDOM library.

Further Reading

593 questions
-2
votes
1 answer

VB.net CodeDom Compiler (Won't compile and not throwing any exceptions

I am making a builder for a silent Monero Miner, My stub won't compile and it isn't throwing any exceptions. Builder.VB Public Class builder Private Sub Button1_Click(sender As Object, e As EventArgs) Handles compileBTN.Click Dim…
-2
votes
1 answer

How can I embed a dll to the output assembly with codedom, and use it as reference using C#?

I have a class library dll which my generated program will use e.g. like this DLL.Do.Something(1); So I have to add this dll to codedom to embed it in the program and set it as reference. But I dont know how to do this and nobodí helped me yet...
-2
votes
2 answers

C# CodeDom "} Expected"

I played a bit with CodeDom and got an error message. The error message is } Expected! I tried searching for the error but could not find anything of value. Why do I get this error? String InputCode = String.Empty; InputCode = "MessageBox.Show((1…
GumGun
  • 15
  • 1
  • 1
  • 5
-3
votes
1 answer

what will be the Execution Time of Coded UI when compared with QTP

I have 300 Test Cases automated in QTP, while after execution it takes almost 430 minutes. If I execute those test cases in CODED UI, will it take more than 430 minutes or less than 430 minutes. Please reply and let me know. Thanks
-3
votes
1 answer

Execute C# Code from string by CodeDom "Performance"?

I have an application perform some calculation logic and this app work with many customers I want to change some formulas for some customers so,I found an article talking on how to execute C# code from strings here by CodeDom and it's working for my…
user897645
  • 85
  • 2
  • 8
-3
votes
3 answers

Error "Does not contain a static "Main" Method suitable for an entry point

I got this Error when I try to compile a sourcecode with CodeDom Does not contain a static "Main" Method suitable for an entry point! I already googled it and read other answers here, but I dont know how to fix it. Can someone please help me? Here…
GumGun
  • 15
  • 1
  • 1
  • 5
-3
votes
2 answers

Prevent Codedom build from being decompiled

Was simply asking about encrypting builds. Sorted now, thanks all<3
Metab
  • 245
  • 1
  • 4
  • 13
-5
votes
1 answer

Dynamic Compilation NullReferenceException error

I'll try to define as mush as possible my problem and forget nothing. For my project, which use a webRequest, I would like to compile dynamically my webRequest. For this I used the CodeDomProvider in a Private Assembly and a public MethodInfo who…
Anynahel
  • 41
  • 6
1 2 3
39
40