This project is read-only.
2
Vote

Throwing message"Cannot compile the generated C# code."

description

Hi,
 
This issue is very odd. It only happened in my box. Here at my place I've tried with other 3 computers, and only mine has the issue.
The following call was always returning null:
 
Assembly autoAssembly = CreatePixelShaderClass.CompileInMemory(codeString);
// FROM CodeTabsView.xaml.cs ln:396
 
So, I took some time reviewing the method compile in memory. Honestly I don't know my instalation wasn't detecting the System DLLS. So, the compiler service was reporting that dlls such as: "System.Core.dll", "WindowsBase.dll", "PresentationFramework.dll", "PresentationCore.dll" were not found.
 
So, I add an option to specify where the .NET dlls are located in the compiler option, and it's being set based on the CurrentDomain. As follows:
 
var path = Path.GetDirectoryName(AppDomain.CurrentDomain
                        .GetAssemblies()
                        .Where(a => !a.IsDynamic)
                        .Select(a => a.Location).FirstOrDefault());
options.CompilerOptions = string.Format("/lib:{0}", path);
 
I'm not sure if there is other optoin to get the valid path, although this solve my issue. I'm attaching the modified CreatePixelShaderClass.cs for you to examinate.
 
Herber

file attachments

comments

WaltRitscher wrote Jun 15, 2011 at 4:55 PM

Thanks. I'll take a look at the issue

wrote Feb 14, 2013 at 2:30 AM

wrote Aug 12, 2015 at 9:18 AM