codedom

How to test a BuildProvider

I have created a simple BuildProvider as a starting point, and althogh I get no errors, I don't have access to the generated class either. In fact, i don't know if my BuildProvider was even invoked. Is there a way to debug a BuildProvider? How do I know if there is a problem with my CodeDom or if it's something else? Thanks! ...

CodeDom.compiler memory

I am generating assembly on runtime . Problem is that i cant get rid-of it after i am done with it. I need to destroy this assambly what i have created string _Errors = ""; object[] parms = null; CodeDomProvider _CodeCompiler = CodeDomProvider.CreateProvider("CSharp"); //new Microsoft.CSharp.CSharpCodeProvider()...

F# Asp.Net CodeDom ProviderOptions Issue

I'm creating an ASP.NET MVC application using F# on IIS 7. When I attempt to run it from the browser, I'm met with a YSOD containing the following: [ArgumentNullException: Value cannot be null. Parameter name: dictionary] System.Collections.Generic.Dictionary2..ctor(IDictionary2 dictionary, IEqualityComparer`1 comparer) +127...

Dynamic code generation

I am currently developing an application where you can create "programs" with it without writing source code, just click&play if you like. Now the question is how do I generate an executable program from my data model. There are many possibilities but I am not sure which one is the best for me. I need to generate assemblies with classes...

Workaround for VB.NET partial method using CodeDom?

I know CodeDom doesn't support partial methods, but is there a workaround? I found a workaround for C#, but I need one for VB.NET. Thanks. ...

Is it possible to construct an object by reading source code?

Background I have a few scripts that run as part of my build process that look at the various source code files and generate some more source code for me. The scripts use CodeDom to generate them and they read the .cs files using a simple text reader. Question One of the scripts is looking for use of a specific class attribute called...

The difference between namespaces in Visual Basic.NET vs in C# and how to deal with them

In C#, if you do this, it will compile: namespace Name { public class Test { } public class TestUse { private global::Name.Test test; } } If you try the same in VB.NET, however, it won't: Namespace Name Public Class Test End Class Public Class TestUse Private test As Global.Name.T...

restricting a codedom compiled assembly

i've written a plugin manager for my app , it utilizes codedom to compile c# code into a class library and instanciate its types. it works perfectly , and now i wish to restrict the permissions on the compiled assembly.unfortunatly i dont know how to do so. as far as i understand i should use CompilerParameters.Evidence in some way, but ...

How to add ASP.net webservice directive to CodeDom generated .asmx file

How can I add <%@ webservice class="MyNamespace.MyClass" ... %> To the top of a CodeDom generated .asmx file? Here's some code to fill this question out a bit more: public void Generate<T>() { string[] importNameSpaces = new string[] { "System","CoreData","System.Web.Services", "System.Data", "System.Text"...

Which .NET Programming Languages Have a CodeDom Provider?

Aside from C#, VB.NET, C++ (Managed and C++/CLI), and F#, which .NET programming languages have their own CodeDom provider? ...

Generate C# automatic properties with Codedom

is there a way Generate C# automatic properties with Codedom or maybe an other set of libreries that i can use ? ...

Generate custom class at design time

I have a component which has a collection of objects (DataProviders). Each DataProvider has a unique name set by the user at design time. How can I make the designer generate a class into an additional file which contains the names of the DataProviders? namespace MyNamespace { public class DpContainer : Component { public DataProviderCo...

How to add a partial method without an implementation using CodeDom

internal List<CodeMemberMethod> createEventHooks() { string[] eventNames = new string[] { "OnUpdate", "OnInsert", "OnDelete", "OnSelect", "OnSelectAll" }; List<CodeMemberMethod> eventHooks = new List<CodeMemberMethod>(); foreach (string eventName in eventNames) { Co...

Finalizer with CodeDom?

Is it possible to add a Finalizer to a CodeDom generated class (other than using CodeSnippetTypeMember)? I couldn't find any information about it on MSDN. ...

How to initialize a member variable in a constructor with CodeDOM?

Hello, I hope can help me, the problem is this, I want to initialize a member variable in the constructor of a class with CodeDOM to achieve something like this: Public Sub New() MyBase.New Me._myOfficeApp = New Microsoft.Office.Interop.Excel.Application End Sub The code I use to do that is: ' Create a Public Class Constr...

Reflection.Emit vs CodeDOM

What are some pros/cons for using the Reflection.Emit library versus CodeDOM for dynamically generating code at runtime? I am trying to generate some (relatively complicated) dynamic classes in a system based on metadata available at runtime in XML form. I will be generating classes that extend existing classes in the application assemb...

VBCodeProvider Error - error BC2006: option 'r' requires':<file_list>'

I am trying to use the VBCodeProvider to dynamically compile an assembly. The problem I'm running in to is that I need to give the CompilerParameters class a list of referenced assemblies. The code being used is this: CompilerParameters parameters = new CompilerParameters(); parameters.ReferencedAssemblies.AddRange(AppDomain.CurrentDom...

C#: How do I change accessibility on an accessor using CodeDom?

In C#, you can have more restrictive accessors on the accessors of a property like this: public List<String> Name { get; protected set; } How can I accomplish this when generating code using CodeDom? ...

How can I use CodeDom to create a decimal constant?

I have this function in my generator. Private Sub AddBoundedValue(ByVal boundedValue As Object, ByVal type As CodeTypeDeclaration, ByVal numericType As Type, name As String) If boundedValue IsNot Nothing Then Dim constant As New CodeMemberField(numericType, name) constant.Attributes = MemberAttribut...

Reflect and Load code at design time in Visual Studio

I have an XML file that lists a series of items, and the items are often referenced by their name in code. Is there any way to use reflection within Visual Studio to make this list 'accessible' sort of like intellisence? I've seen it done before - and I'm pretty sure it's ridiculously difficult, but I figure it can't hurt to at least a...