Throws "Compiler executable file csc.exe cannot be found."

4,688 views
Skip to first unread message

bill

unread,
Jun 24, 2011, 11:14:31 AM6/24/11
to nhprof
Hi,

I'm trying to profile my wcf app, which uses nHibernate, I included
the 4.0 dll, and then called initialize within my factory class (based
off ServiceHostFactory) and the service won't run, the initialize line
throws
"Compiler executable file csc.exe cannot be found."

Any ideas? Also, when i try and run nhprof.exe, it crashes, with
little info:

Description:
Stopped working

Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01: nhprof.exe
Problem Signature 02: 1.0.0.0
Problem Signature 03: 4e0334a5
Problem Signature 04: NHProf
Problem Signature 05: 1.0.0.0
Problem Signature 06: 4e0334a5
Problem Signature 07: 8a9
Problem Signature 08: 30
Problem Signature 09: System.TypeInitialization
OS Version: 6.0.6002.2.2.0.272.36
Locale ID: 1033



Full stack of WCF Exception
[InvalidOperationException: Compiler executable file csc.exe cannot be
found.]

System.CodeDom.Compiler.RedistVersionInfo.GetCompilerPath(IDictionary`2
provOptions, String compilerExecutable) +7682169

Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters
options, String[] fileNames) +835

Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters
options, String[] sources) +3103150

Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters
options, String[] sources) +64

HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.Compile(String
fileName, String[] sources, IEnumerable`1 assembliesToReference) +1196

HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileAssembly(IEnumerable`1
sourcesResources, IEnumerable`1 assembliesToReference, String
assemblyName) +118

HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.RegisterAppenderUsingNHibernateLogger()
+399

HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.WrapLogger()
+138

HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.StartNHibernateProfiling()
+183

HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize(NHibernateAppenderConfiguration
configuration) +74

HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize()
+73
UserInventoryService.ServiceFactory..ctor() in C:\projects\dropdeck
\git\UserService\UserInventoryService\ServiceFactory.cs:16

[TargetInvocationException: Exception has been thrown by the target of
an invocation.]
System.RuntimeMethodHandle._InvokeConstructor(IRuntimeMethodInfo
method, Object[] args, SignatureStruct& signature, RuntimeType
declaringType) +0
System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
+651
System.ServiceModel.HostingManager.CreateService(String
normalizedVirtualPath) +1204
System.ServiceModel.HostingManager.ActivateService(String
normalizedVirtualPath) +50
System.ServiceModel.HostingManager.EnsureServiceAvailable(String
normalizedVirtualPath) +1132

[ServiceActivationException: The service '/UserInventoryService.svc'
cannot be activated due to an exception during compilation. The
exception message is: Exception has been thrown by the target of an
invocation..]
System.Runtime.AsyncResult.End(IAsyncResult result) +890624

System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult
result) +180062

System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult
ar) +107

Ayende Rahien

unread,
Jun 26, 2011, 6:13:26 AM6/26/11
to nhp...@googlegroups.com
We are doing some dynamic compilation on the fly to get around version dependencies. The csc.exe compiler should be part of any installation of the .NET framework, it doesn't really make sense that you don't have it.


--
You received this message because you are subscribed to the Google Groups "nhprof" group.
To post to this group, send email to nhp...@googlegroups.com.
To unsubscribe from this group, send email to nhprof+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhprof?hl=en.


Ryan Harris

unread,
Jun 26, 2011, 1:59:38 PM6/26/11
to nhp...@googlegroups.com
Is it possible that the .NET framework folders just aren't in your path?
--
Ryan Harris
Xtheta, Inc. | www.xtheta.com

bill keenan

unread,
Jun 27, 2011, 10:24:12 AM6/27/11
to nhp...@googlegroups.com
Where would it be looking for csc?

bill keenan

unread,
Jun 27, 2011, 10:24:28 AM6/27/11
to nhp...@googlegroups.com
Ah, I will investigate.

Chris

unread,
Jun 29, 2011, 2:06:36 PM6/29/11
to nhp...@googlegroups.com
I've got the same problem.
I have a feeling that it has more to do with permissions someway somehow.

I'm trying to run my application under IIS7.5 with a domain account as the appdomain identity in an effort to allow a trusted connection to reach the sql server. 

A quick check with procmon shows that the w3wp process is indeed finding csc.exe just fine for its own work but then conhost.exe is attempting to find csc.exe and it looks in the following folders before giving up:

C:\Windows\SysWOW64\inetsrv\csc.exe
C:\Windows\System32\csc.exe
C:\Windows\System32\csc.exe
C:\Windows\System32\csc.exe
C:\Windows\system\csc.exe
C:\Windows\csc.exe
C:\Windows\System32\csc.exe
C:\Windows\csc.exe
C:\Windows\System32\wbem\csc.exe
C:\Windows\System32\WindowsPowerShell\v1.0\csc.exe

I'm not sure why it's looking in the same folder more than once but that's a problem for somebody else.

My IIS7.5 config is running on a pretty much clean install of Win2008 Server R2 Web edition.

Ayende Rahien

unread,
Jun 30, 2011, 3:10:34 AM6/30/11
to nhp...@googlegroups.com
Hm,
Can you give me the details about how to reproduce this?

--
You received this message because you are subscribed to the Google Groups "nhprof" group.
To view this discussion on the web visit https://groups.google.com/d/msg/nhprof/-/TWekw3uj16EJ.

Chris

unread,
Jun 30, 2011, 9:29:46 PM6/30/11
to nhp...@googlegroups.com
Hi Ayende,
I ran into this in my staging environment at the office today and assumed it was some sort of permissions issue due to running the app pool under a domain account but I was able to reproduce it on just my home machine as well
So I went through and created a repro for you based on my home environment. If there's anything more you need to know I will do my best to help get it together for you.

Here are the exact steps followed:

Windows 7 Home Premium w/ IIS installed

- Created a brand new MVC3 Internet Application from the template and using nuget added Nhibernate 3.2.0.2002 and NHProf 1.0.0.894 (both most recent at time of testing)
- Added NHibernateProfiler.Initialize() to the end of the Application_Start method in the Global.asax
- Deployed the site to an application under the default web site in IIS 7 with the default app pool but changed to run .NET 4 and in integrated mode
- Launched the site

Upon accessing the site it crashes with:

[InvalidOperationException: Source file 'C:\Windows\TEMP\co2a3wci.0.cs' could not be found]
   HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.Compile(String fileName, String[] sources, IEnumerable`1 assembliesToReference) +1463
   HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileAssembly(IEnumerable`1 sourcesResources, IEnumerable`1 assembliesToReference, String assemblyName) +118
   HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.RegisterAppenderUsingNHibernateLogger() +399
   HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.WrapLogger() +138
   HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.StartNHibernateProfiling() +183
   HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize(NHibernateAppenderConfiguration configuration) +74
   HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize() +73
   MvcApplication1.MvcApplication.Application_Start() in D:\dev\MvcApplication1\MvcApplication1\Global.asax.cs:40

[HttpException (0x80004005): Source file 'C:\Windows\TEMP\co2a3wci.0.cs' could not be found]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +4051717
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +352
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375

[HttpException (0x80004005): Source file 'C:\Windows\TEMP\co2a3wci.0.cs' could not be found]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11642112
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4865877

Note that this works fine in IIS Express and in Cassini but fails under full blown IIS 7.

- Chris

Chris

unread,
Jun 30, 2011, 10:18:24 PM6/30/11
to nhp...@googlegroups.com
Which upon closer inspection isn't exactly the same error as I was getting at the office, as I was getting the unable to find csc.exe error. The primary difference there is that it was on Windows Server 2008 R2 and the IIS app pool was running under a domain account which would not have had explicit access to anything except the actual website's folder.

Unfortunately I don't have the means to try to reproduce that for you until next week. 

Ayende Rahien

unread,
Jul 1, 2011, 4:23:48 AM7/1/11
to nhp...@googlegroups.com
Okay, I know what is causing it, and it is a permission issue.
During the init process, we generate a dll at runtime, and we need permissions to write to the temp directory. Can you grant those?

On Fri, Jul 1, 2011 at 5:18 AM, Chris <ch...@xcrew.net> wrote:
Which upon closer inspection isn't exactly the same error as I was getting at the office, as I was getting the unable to find csc.exe error. The primary difference there is that it was on Windows Server 2008 R2 and the IIS app pool was running under a domain account which would not have had explicit access to anything except the actual website's folder.

Unfortunately I don't have the means to try to reproduce that for you until next week. 

--
You received this message because you are subscribed to the Google Groups "nhprof" group.
To view this discussion on the web visit https://groups.google.com/d/msg/nhprof/-/txRfBxWzqhcJ.

Oren Eini (Ayende Rahien)

unread,
Jun 18, 2012, 11:42:43 AM6/18/12
to nhp...@googlegroups.com
It is usually fixed by installing the SDK again

On Mon, Jun 18, 2012 at 6:18 PM, Bill K <bi...@bigmojo.net> wrote:
Did this ever get resolved? I just tried to use nhprof, got this error, searched, and saw that in fact I had the same thing a year ago when i tried last time. and here i am again.

Totally different machine, exact same issue.

BIll.
To unsubscribe from this group, send email to nhprof+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/nhprof?hl=en.

--
You received this message because you are subscribed to the Google Groups "nhprof" group.
To view this discussion on the web visit https://groups.google.com/d/msg/nhprof/-/OI0FiJU2kSUJ.

Oren Eini (Ayende Rahien)

unread,
Feb 7, 2013, 11:39:40 AM2/7/13
to nhprof
Can you try reinstalling the .NET framework SDK?


On Thu, Feb 7, 2013 at 6:30 PM, Enric Carrión <enric...@gmail.com> wrote:
Hi, we've found the same error in several Win2008R2 machines with IIS7, Visual Studio 2010 and SharePoint 2010. At some point, the Initialize call starts giving the "Compiler executable file csc.exe cannot be found." error. Even one of those machines is a clean installation. We've tried to repair the .NET Framework but it made no difference. Apparently the Framework is ok checking it with a tool like http://blogs.msdn.com/b/astebner/archive/2008/10/13/8999004.aspx 

If anyone finds a workaround, please post. Thank you!


El lunes, 18 de junio de 2012 17:42:43 UTC+2, Ayende Rahien escribió:
It is usually fixed by installing the SDK again

On Mon, Jun 18, 2012 at 6:18 PM, Bill K <bi...@bigmojo.net> wrote:
Did this ever get resolved? I just tried to use nhprof, got this error, searched, and saw that in fact I had the same thing a year ago when i tried last time. and here i am again.

Totally different machine, exact same issue.

BIll.


On Friday, 1 July 2011 04:23:48 UTC-4, Ayende Rahien wrote:
Okay, I know what is causing it, and it is a permission issue.
During the init process, we generate a dll at runtime, and we need permissions to write to the temp directory. Can you grant those?

On Fri, Jul 1, 2011 at 5:18 AM, Chris <ch...@xcrew.net> wrote:
Which upon closer inspection isn't exactly the same error as I was getting at the office, as I was getting the unable to find csc.exe error. The primary difference there is that it was on Windows Server 2008 R2 and the IIS app pool was running under a domain account which would not have had explicit access to anything except the actual website's folder.

Unfortunately I don't have the means to try to reproduce that for you until next week. 

--
You received this message because you are subscribed to the Google Groups "nhprof" group.
To view this discussion on the web visit https://groups.google.com/d/msg/nhprof/-/txRfBxWzqhcJ.

To post to this group, send email to nhp...@googlegroups.com.
To unsubscribe from this group, send email to nhprof+un...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/nhprof?hl=en.

--
You received this message because you are subscribed to the Google Groups "nhprof" group.
To view this discussion on the web visit https://groups.google.com/d/msg/nhprof/-/OI0FiJU2kSUJ.

To post to this group, send email to nhp...@googlegroups.com.
To unsubscribe from this group, send email to nhprof+un...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/nhprof?hl=en.

--
You received this message because you are subscribed to the Google Groups "nhprof" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhprof+un...@googlegroups.com.

To post to this group, send email to nhp...@googlegroups.com.

Enric Carrión

unread,
Feb 11, 2013, 3:00:33 AM2/11/13
to nhp...@googlegroups.com
I have tried to uninstall completely and install again .NET Framework 4. The "csc.exe" error still appears.

The next thing I could do is uninstall and install .NET Framework 3.5 but it is not possible in my scenario, because as it's a W2008R2, it implies unistalling/reinstalling the server feature and so the Active Directory services, which breaks my SharePoint. This machine was a clean install and I've never managed to initialize the profiler.

The code of the initialization is compiled in .NET 3.5 and the web app pool hosting that code is Framework 2.0 (as requested by SharePoint). Could this be a clue? However, as I said, in other machines under the same conditions I was able to profile until the error appeared.

Oren Eini (Ayende Rahien)

unread,
Feb 11, 2013, 3:33:04 AM2/11/13
to nhprof
It isn't the .NET framework that is causing the problem.
You need to install the _SDK_

Enric Carrión

unread,
Feb 11, 2013, 7:44:20 AM2/11/13
to nhp...@googlegroups.com
I've just installed the .NET Framework 2.0 SDK (http://www.microsoft.com/en-us/download/details.aspx?id=15354). No luck, same error.

After that, I also have installed the Windows SDK for Windows Server 2008 and .NET Framework 3.5 (http://www.microsoft.com/en-us/download/details.aspx?id=11310). Keeps giving the same error.

Are we talking of the same SDK's ?

Fitzchak Yitzchaki

unread,
Feb 11, 2013, 7:55:55 AM2/11/13
to nhp...@googlegroups.com
Let me check a few things.

What is the result of this on your machine?

namespace Tryout
{
class Program
{
static void Main(string[] args)
{
var runtimeDirectory = RuntimeEnvironment.GetRuntimeDirectory();
Console.WriteLine(runtimeDirectory);
}
}
}

Fitzchak Yitzchaki

unread,
Feb 11, 2013, 8:16:51 AM2/11/13
to nhp...@googlegroups.com
Please try the next build (#2131) and see if this fixed the issue.

Enric Carrión

unread,
Feb 11, 2013, 9:25:58 AM2/11/13
to nhp...@googlegroups.com
With this new build the exception now is:

net4exception: System.InvalidOperationException: The type or namespace name 'var' could not be found (are you missing a using directive or an assembly reference?)
   at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileInternally(String fileName, List`1 sources, HashSet`1 assemblies, HashSet`1 defineSymbols, String outputFolder, String compilerVersion)
   at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileAssembly(List`1 sources, HashSet`1 assemblies, HashSet`1 defineSymbols, String assemblyFileName, String outputFolder)
net35exception: System.InvalidOperationException: The type or namespace name 'var' could not be found (are you missing a using directive or an assembly reference?)
   at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileInternally(String fileName, List`1 sources, HashSet`1 assemblies, HashSet`1 defineSymbols, String outputFolder, String compilerVersion)
   at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileAssembly(List`1 sources, HashSet`1 assemblies, HashSet`1 defineSymbols, String assemblyFileName, String outputFolder)

The value of my RuntimeEnvironment.GetRuntimeDirectory() is C:\Windows\Microsoft.NET\Framework64\v2.0.50727\

Fitzchak Yitzchaki

unread,
Feb 11, 2013, 10:34:28 AM2/11/13
to nhp...@googlegroups.com
What does the value of RuntimeEnvironment.GetRuntimeDirectory() on your machine?

namespace Tryout
{
class Program
{
static void Main(string[] args)
{
var runtimeDirectory = RuntimeEnvironment.GetRuntimeDirectory();
Console.WriteLine(runtimeDirectory);
}
}
}

Does this file not exists? C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe\csc.exe


On Mon, Feb 11, 2013 at 5:25 PM, Paweł Krakowiak <pawel.k...@gmail.com> wrote:
I have the same issue on Windows Server 2008 R2, .NET 4.0. I noticed the path to the csc.exe executable is wrong, the file name occurs twice. This is what I saw when running an ASP.NET MVC app with HibernatingRhinos.Profiler.Appender.dll version  2132:

[InvalidOperationException: net4exception: System.InvalidOperationException: Compiler executable file C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe\csc.exe cannot be found.

--
You received this message because you are subscribed to the Google Groups "nhprof" group.

Fitzchak Yitzchaki

unread,
Feb 11, 2013, 10:40:58 AM2/11/13
to nhp...@googlegroups.com
OK, this will be fixed in the next build which we just pushed and expected to be published in 30 minutes.
You can also use the prev build for now.

Paweł Krakowiak

unread,
Feb 12, 2013, 4:19:41 AM2/12/13
to nhp...@googlegroups.com
Thank you for quick response! The last build fixed the issue.

Fitzchak Yitzchaki

unread,
Feb 18, 2013, 5:33:27 AM2/18/13
to nhp...@googlegroups.com
Is this a valid path on your machine? C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe.
Also, is this the full exception?


On Mon, Feb 18, 2013 at 12:11 PM, Marc Vall-llosera <marc...@gmail.com> wrote:
I still have the same issue with latest version 2135 on Windows Server 2008 R2 when initializing NHibernateProfiler from Sharepoint 2010. It uses .NET Framework 3.5.

Trying a console application it works fine if i set .NET Framework 4 as target framework but the same error if .NET Framework 3.5 is specified.

We have a collegue from other team who is running NHProfiler build 951 and it's working with 3.5.

Exception:

net4exception: System.InvalidOperationException: Compiler executable file csc.exe cannot be found.
   at System.CodeDom.Compiler.RedistVersionInfo.GetCompilerPath(IDictionary`2 provOptions, String compilerExecutable)
   at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)
   at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources)
   at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources)
   at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(CompilerParameters options, String[] sources)
   at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileInternally(String fileName, List`1 sources, HashSet`1 assemblies, HashSet`1 defineSymbols, String outputFolder, String compilerVersion)
   at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileAssembly(List`1 sources, HashSet`1 assemblies, HashSet`1 defineSymbols, String assemblyFileName, String outputFolder)

Marc Vall-llosera

unread,
Feb 18, 2013, 5:55:22 AM2/18/13
to nhp...@googlegroups.com
Yes, it's a valid path. Full exception is:

System.InvalidOperationException was unhandled
  Message=net4exception: System.InvalidOperationException: Compiler executable file csc.exe cannot be found.
   at System.CodeDom.Compiler.RedistVersionInfo.GetCompilerPath(IDictionary`2 provOptions, String compilerExecutable)
   at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)
   at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources)
   at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources)
   at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(CompilerParameters options, String[] sources)
   at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileInternally(String fileName, List`1 sources, HashSet`1 assemblies, HashSet`1 defineSymbols, String outputFolder, String compilerVersion)
   at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileAssembly(List`1 sources, HashSet`1 assemblies, HashSet`1 defineSymbols, String assemblyFileName, String outputFolder)
net35exception: System.InvalidOperationException: Compiler executable file csc.exe cannot be found.
   at System.CodeDom.Compiler.RedistVersionInfo.GetCompilerPath(IDictionary`2 provOptions, String compilerExecutable)
   at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)
   at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources)
   at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources)
   at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(CompilerParameters options, String[] sources)
   at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileInternally(String fileName, List`1 sources, HashSet`1 assemblies, HashSet`1 defineSymbols, String outputFolder, String compilerVersion)
   at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileAssembly(List`1 sources, HashSet`1 assemblies, HashSet`1 defineSymbols, String assemblyFileName, String outputFolder)
  Source=HibernatingRhinos.Profiler.Appender
  StackTrace:
       at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileAssembly(List`1 sources, HashSet`1 assemblies, HashSet`1 defineSymbols, String assemblyFileName, String outputFolder)
       at HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.RegisterAppenderUsingNHibernateLogger()
       at HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.WrapLogger()
       at HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.StartNHibernateProfiling()
       at HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize(NHibernateAppenderConfiguration configuration)
       at HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize()
       at ConsoleApplication1.Program.Main(String[] args) in C:\development\Temp\ConsoleApplication1\ConsoleApplication1\Program.cs:line 17
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

Fitzchak Yitzchaki

unread,
Feb 18, 2013, 6:49:08 AM2/18/13
to nhp...@googlegroups.com
This will be fixed in the next build, which should be out in 30 minutes.

Marc Vall-llosera

unread,
Feb 18, 2013, 8:11:00 AM2/18/13
to nhp...@googlegroups.com
New exception when initializing NHProfiler from Sharepoint 2010 (it works fine from console application).

Any workaround?

System.InvalidOperationException occurred
  Message=net4exception: System.InvalidOperationException: Compiler executable file csc.exe cannot be found.
   at System.CodeDom.Compiler.RedistVersionInfo.GetCompilerPath(IDictionary`2 provOptions, String compilerExecutable)
   at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)
   at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources)
   at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources)
   at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(CompilerParameters options, String[] sources)
   at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileInternally(String fileName, List`1 sources, HashSet`1 assemblies, HashSet`1 defineSymbols, String outputFolder, String compilerVersion)
   at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileAssembly(List`1 sources, HashSet`1 assemblies, HashSet`1 defineSymbols, String assemblyFileName, String outputFolder)
net35exception: System.IO.FileLoadException: Could not load file or assembly 'HibernatingRhinos.Profiler.Appender.NHibernate3Logger, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0x80131418)
File name: 'HibernatingRhinos.Profiler.Appender.NHibernate3Logger, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' ---> System.Security.Policy.PolicyException: Execution permission cannot be acquired.
   at System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission)
   at System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission)
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef, Evidence assemblySecurity)
   at System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly()
   at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileInternally(String fileName, List`1 sources, HashSet`1 assemblies, HashSet`1 defineSymbols, String outputFolder, String compilerVersion)
   at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileAssembly(List`1 sources, HashSet`1 assemblies, HashSet`1 defineSymbols, String assemblyFileName, String outputFolder)


  Source=HibernatingRhinos.Profiler.Appender
  StackTrace:
       at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileAssembly(List`1 sources, HashSet`1 assemblies, HashSet`1 defineSymbols, String assemblyFileName, String outputFolder)
       at HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.RegisterAppenderUsingNHibernateLogger()
       at HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.WrapLogger()
       at HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.StartNHibernateProfiling()
       at HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize(NHibernateAppenderConfiguration configuration)
       at HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize()
       at Spenta.Beezy.CrossCutting.NHibernateProfilerHelper.Initialize()
  InnerException: 

Fitzchak Yitzchaki

unread,
Feb 18, 2013, 8:32:13 AM2/18/13
to nhp...@googlegroups.com

Marc Vall-llosera

unread,
Feb 18, 2013, 9:33:54 AM2/18/13
to nhp...@googlegroups.com
It doesn't work. The file HibernatingRhinos.Profiler.Appender.NHibernate3Logger.dll is generated at C:\Users\sppool\AppData\Local\Temp

I grant permissions to that folder with:

caspol -u -ag All_Code -url C:\<FolderName>\<FolderName>\* FullTrust -n "<Name>" -d "<Description>"

But this is the exception thrown when initializing:


System.InvalidOperationException occurred
  Message=net4exception: System.InvalidOperationException: Compiler executable file csc.exe cannot be found.
   at System.CodeDom.Compiler.RedistVersionInfo.GetCompilerPath(IDictionary`2 provOptions, String compilerExecutable)
   at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)
   at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources)
   at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources)
   at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(CompilerParameters options, String[] sources)
   at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileInternally(String fileName, List`1 sources, HashSet`1 assemblies, HashSet`1 defineSymbols, String outputFolder, String compilerVersion)
   at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileAssembly(List`1 sources, HashSet`1 assemblies, HashSet`1 defineSymbols, String assemblyFileName, String outputFolder)
net35exception: System.IO.FileLoadException: Could not load file or assembly 'file:///C:\Users\sppool\AppData\Local\Temp\HibernatingRhinos.Profiler.Appender.NHibernate3Logger.dll' or one of its dependencies. Access is denied.
File name: 'file:///C:\Users\sppool\AppData\Local\Temp\HibernatingRhinos.Profiler.Appender.NHibernate3Logger.dll'
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef, Evidence assemblySecurity)
   at System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly()
   at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileInternally(String fileName, List`1 sources, HashSet`1 assemblies, HashSet`1 defineSymbols, String outputFolder, String compilerVersion)
   at HibernatingRhinos.Profiler.Appender.Util.GenerateAssembly.CompileAssembly(List`1 sources, HashSet`1 assemblies, HashSet`1 defineSymbols, String assemblyFileName, String outputFolder)

=== Pre-bind state information ===
LOG: User = BIMS\rodu
LOG: Where-ref bind. Location = C:\Users\sppool\AppData\Local\Temp\HibernatingRhinos.Profiler.Appender.NHibernate3Logger.dll
LOG: Appbase = file:///C:/inetpub/wwwroot/wss/VirtualDirectories/SV-BIMS80/
LOG: Initial PrivatePath = C:\inetpub\wwwroot\wss\VirtualDirectories\SV-BIMS80\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\inetpub\wwwroot\wss\VirtualDirectories\SV-BIMS80\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
LOG: Attempting download of new URL file:///C:/Users/sppool/AppData/Local/Temp/HibernatingRhinos.Profiler.Appender.NHibernate3Logger.dll.
ERR: A fatal error occurred when retrieving next codebase for download (hr = 0x80070005).

Fitzchak Yitzchaki

unread,
Feb 18, 2013, 9:42:34 AM2/18/13
to nhp...@googlegroups.com
Can you give me some sample project that reproduce the issue?

Marc Vall-llosera

unread,
Feb 18, 2013, 9:59:36 AM2/18/13
to nhp...@googlegroups.com
Not easy because it's a Sharepoint solution.

Fitzchak Yitzchaki

unread,
Feb 18, 2013, 10:05:26 AM2/18/13
to nhp...@googlegroups.com
How does it doesn't have an access to this file if it created it?
Will need some way to reproduce to see what we can do here

Marc Vall-llosera

unread,
Feb 18, 2013, 12:03:25 PM2/18/13
to nhp...@googlegroups.com
Before grant permissions the error was

Could not load file or assembly 'HibernatingRhinos.Profiler.Appender.NHibernate3Logger, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant permission to execute.

After:

Could not load file or assembly 'file:///C:\Users\sppool\AppData\Local\Temp\HibernatingRhinos.Profiler.Appender.NHibernate3Logger.dll' or one of its dependencies. Access is denied.

The application pool user has full permissions to this file. Is it possible a problem with some dependency?

Marc Vall-llosera

unread,
Feb 20, 2013, 6:19:04 AM2/20/13
to nhp...@googlegroups.com
Is it possible to download an older version that used to work (i.e. build 951) and try it?

Oren Eini (Ayende Rahien)

unread,
Feb 20, 2013, 6:20:43 AM2/20/13
to nhprof
Try it for what purpose? We do not offer it any longer.

Fitzchak Yitzchaki

unread,
Feb 20, 2013, 6:30:01 AM2/20/13
to nhp...@googlegroups.com
Could you try the previous builds?
We did a lot of changes to the way we generate the assembly, figuring out on what build this started to now work will make it either to narrow down the cause to the issue.
Please start to use build #2122 and see if this working with it:

Marc Vall-llosera

unread,
Feb 21, 2013, 4:13:32 AM2/21/13
to nhp...@googlegroups.com
I just want to trace the queries cached by NHibernate Query Cache initializing the profiler from Sharepoint 2010.

I tried build #2122 and same error:

net35exception: System.IO.FileLoadException: Could not load file or assembly 'HibernatingRhinos.Profiler.Appender.NHibernate3Logger, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0x80131418)
File name: 'HibernatingRhinos.Profiler.Appender.NHibernate3Logger, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' ---> System.Security.Policy.PolicyException: Execution permission cannot be acquired.


Fitzchak Yitzchaki

unread,
Feb 21, 2013, 4:23:26 AM2/21/13
to nhp...@googlegroups.com
Strange. Just to be sure, we're talking about the build version of the _appender_.
What about build #2088?

Marc Vall-llosera

unread,
Feb 21, 2013, 4:40:45 AM2/21/13
to nhp...@googlegroups.com
Build #2088 works! Thx.

Fitzchak Yitzchaki

unread,
Feb 25, 2013, 6:54:33 AM2/25/13
to nhp...@googlegroups.com

Detalive

unread,
Jul 20, 2016, 6:54:10 AM7/20/16
to nhprof
Again issue with csc ???? 

Fitzchak Yitzchaki

unread,
Jul 20, 2016, 6:56:03 AM7/20/16
to nhp...@googlegroups.com
What issue do you have?
Please create a new thread.

Best Regards,

Hibernating Rhinos Ltd  cid:image001.png@01CF95E2.8ED1B7D0

Fitzchak Yitzchaki l Senior Software Engineer Mobile:+972-58-345-9538


On Wed, Jul 20, 2016 at 12:04 PM, Detalive <graffy...@gmail.com> wrote:
Again issue with csc ???? 

--
You received this message because you are subscribed to the Google Groups "nhprof" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhprof+un...@googlegroups.com.
To post to this group, send email to nhp...@googlegroups.com.
Visit this group at https://groups.google.com/group/nhprof.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages