Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.CodeDom.Compiler;
- using System.Reflection;
- namespace ReflectionIssue
- {
- class Program
- {
- static void Main(string[] args)
- {
- CompilerParameters cp = new CompilerParameters();
- cp.GenerateInMemory = true;
- cp.GenerateExecutable = false;
- string[] sources = new string[1];
- sources[0] =
- @"
- using System.Collections.Concurrent;
- public static class TestClass
- {
- public static void TestMethod()
- {
- //ConcurrentBag<int> a = new ConcurrentBag<int>(); // FAILS IF NOT COMMENTED OUT - WTF
- ConcurrentDictionary<int, int> b = new ConcurrentDictionary<int, int>();
- ConcurrentQueue<int> c = new ConcurrentQueue<int>();
- ConcurrentStack<int> d = new ConcurrentStack<int>();
- }
- }
- ";
- CompilerResults r = CodeDomProvider.CreateProvider("CSharp").CompileAssemblyFromSource(cp, sources);
- Assembly asm = r.CompiledAssembly;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement