Click or drag to resize
Frequently Asked Questions

The following are some frequently asked questions and their answers.

Why would I want to use the Nova CodeDOM library?

It will be very useful whenever you need to programmatically manipulate C# source code, such as automatically reformatting, calculating metrics, performing static analysis or refactoring, generating code, displaying code graphically or with colorized text, etc. It models all features of the C# 6.0 language using objects which are specifically designed to model the semantics (meaning) of the language as opposed to the syntax, so you don't have to worry about whitespace, braces, etc. It handles these using default settings, but you can also choose to have some control over them if you wish.

What is the basic architecture of the Nova CodeDOM library?

Nova stores programs as objects instead of text, converting to/from text when importing or exporting code. Solution and/or project files are loaded, and all C# source files are parsed into objects. After parsing is complete, all symbolic references are resolved, which includes the handling of various language rules to determine the best match for each reference. Any parsing or symbol resolution problems are flagged as errors. Symbol resolution can be bypassed if it's not needed, such as when only formatting the code. Code can be inspected, analyzed, and modified, and any changes can be exported back to text if desired.

The object model is optimized to keep the memory requirements for code objects low, so that large amounts of code can be modeled efficiently. Programs as objects brings many benefits, and is the eventual future of software development. However, in order to keep the object model from becoming overly complex and memory-hungry, some rarely or never used formatting options are not supported, such as blank lines or comments in a few places where they are almost never seen in C# sources.

How are comments, attributes, and compiler directives handled?

Comments, attributes, and compiler directives are considered Annotations, and are associated with an adjacent code object if possible without ambiguity (otherwise, they are standalone). Conditional compiler directives are evaluated according to any defined symbols in scope, and any inactive source code is stored along with them. Therefore, changing any defined symbols requires re-parsing of the source code to properly update the code object tree.

How is type metadata read from referenced assemblies?

Referenced assemblies are loaded using Mono Cecil by default, which is integrated into the Nova.CodeDOM.dll. They can alternatively be loaded using .NET Reflection by setting ApplicationContext.UseMonoCecilLoads to false with code or in the .config file. Mono Cecil is faster than Reflection, but uses up to twice as much memory. Reflection sometimes has problems loading assemblies due to code access security or other issues, and assemblies can't be unloaded from memory once loaded (this can be worked around by spawning a child process each time a solution is loaded).

Which Nova CodeDOM files can be redistributed with my own products?

You should only distribute the Nova.CodeDOM.dll assembly with your products, and you should package this DLL inside your own DLL or EXE if you use a protection product that allows for this. Your license code should not be distributed in a separate file, but should be embedded as a resource inside your own product that makes use of the Nova CodeDOM library (see next question). No other files should be distributed.

How do I distribute my Nova CodeDOM license code with my own products?

Put your license code in a text file named "Nova.CodeDOM.License", add it to your project, and set the Build Action to Embedded Resource. Alternatively, you can add it as a string resource named "License" in any ".resx" resource file.

Where can I get more information about Nova products?

Send an email to: info@inevitablesoftware.com

How do I get a question answered that doesn't appear in this list?

Send an email asking the question to the 'Send comments on this topic to' address at the bottom of this page.