Phalanger not using VirtualPathProvider to find source file
description
Hi. I have created a project in which all my .php files are set to build action EmbeddedResource, and in my main web.project I have referenced this project, and use a custom VirtualPathProvider to find the files when they are requested by ASP.NET.
Normally, the ASP pipeline would compile the VirtualFile returned from the VirtualPathProvider. Phalanger it seems does not use this, and instead looks for the file on disk. The correct behaviour would be for Phalanger to use the stream, and to do all lookups via the VirtualPathProvider, not the filesystem.
Fixing this bug would create entertaining possibilities, like Wordpress stored in a Nuget package that can be included into ASP projects as a single dll reference.
Server Error in '/' Application.
Could not find file 'C:\projects\snipped\snipped.Web\index.php'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not find file 'C:\projects\snipped\snipped.Web\index.php'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[FileNotFoundException: Could not find file 'C:\projects\snipped\snipped.Web\index.php'.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +9724575
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath) +1142
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) +83
PHP.Core.Reflection.SourceFileUnit.Parse(ErrorSink errors, IReductionsSink reductionsSink, Position initialPosition, LanguageFeatures features) +157
[InvalidSourceException: Exception of type 'PHP.Core.InvalidSourceException' was thrown.]
PHP.Core.Reflection.SourceFileUnit.Parse(ErrorSink errors, IReductionsSink reductionsSink, Position initialPosition, LanguageFeatures features) +284
PHP.Core.Reflection.ScriptCompilationUnit.ParseSourceFile(SourceUnit sourceUnit, ErrorSink errors, LanguageFeatures languageFeatures) +220
PHP.Core.Reflection.ScriptCompilationUnit.Parse(CompilationContext context) +797
PHP.Core.Reflection.InclusionGraphBuilder.ProcessNode(ScriptCompilationUnit node) +76
PHP.Core.Reflection.InclusionGraphBuilder.AnalyzeDfsTree(PhpSourceFile rootSourceFile) +173
PHP.Core.Emit.ScriptAssemblyBuilder.CompileScripts(IEnumerable`1 sourceFiles, String duckPath, String duckNamespace, CompilationContext context) +345
PHP.Core.WebServerCompilerManager.CompileScriptNoLock(String ns, PhpSourceFile sourceFile, RequestContext requestContext) +372
PHP.Core.WebServerCompilerManager.GetCompiledScript(PhpSourceFile sourceFile, RequestContext requestContext) +401
PHP.Core.RequestContext.GetCompiledScript(PhpSourceFile sourceFile) +75
PHP.Core.RequestHandler.ProcessRequest(HttpContext context) +304
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75