This repo is the official home of .NET on GitHub. It's a great starting point to find many .NET OSS projects from Microsoft and the community, including many that are part of the .NET Foundation.
I have a little problem with .net 5.0. I have a web framework, that parses the c# code and compile it. When it is compiling it is adding the references to the CSharpCompilation using MetadataReference.CreateFromFile(assembly.Location)
It is working normally, however, if the web framework executable compiled to a single file and tries to compile the c# code coming from web framework code using MetadataReference.CreateFromFile(assembly.Location) assembly.Location is returning an empty string and it leads to failure. If I skip the empty values of assembly.Location for references, this time it is creating a huge error mention in the title of this issue. the whole output is like,
System.Exception: warning CS8021: No value for RuntimeMetadataVersion found. No assembly containing System.Object was found nor was a value for RuntimeMetadataVersion specified through options.
(1,7): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
(2,7): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
(3,7): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
(4,7): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
(5,13): error CS0234: The type or namespace name 'Web' does not exist in the namespace 'Xeora' (are you missing an assembly reference?)
(6,13): error CS0234: The type or namespace name 'Web' does not exist in the namespace 'Xeora' (are you missing an assembly reference?)
(15,14): error CS0518: Predefined type 'System.Object' is not defined or imported
(8,50): error CS0246: The type or namespace name 'DomainExecutable' could not be found (are you missing a using directive or an assembly reference?)
(15,53): error CS0518: Predefined type 'System.Object' is not defined or imported
(8,179): error CS0518: Predefined type 'System.String' is not defined or imported
(8,199): error CS0518: Predefined type 'System.Object' is not defined or imported
(8,199): error CS0246: The type or namespace name 'MethodInfo' could not be found (are you missing a using directive or an assembly reference?)
(8,163): error CS0518: Predefined type 'System.Void' is not defined or imported
(9,34): error CS0518: Predefined type 'System.String' is not defined or imported
(9,58): error CS0518: Predefined type 'System.Object' is not defined or imported
(9,17): error CS0518: Predefined type 'System.Void' is not defined or imported
(10,17): error CS0518: Predefined type 'System.Void' is not defined or imported
(11,45): error CS0518: Predefined type 'System.String' is not defined or imported
(11,17): error CS0518: Predefined type 'System.Object' is not defined or imported
(11,17): error CS0246: The type or namespace name 'ResolutionResult' could not be found (are you missing a using directive or an assembly reference?)
(12,51): error CS0518: Predefined type 'System.String' is not defined or imported
(12,17): error CS0518: Predefined type 'System.Object' is not defined or imported
(12,17): error CS0246: The type or namespace name 'PermissionResult' could not be found (are you missing a using directive or an assembly reference?)
(13,45): error CS0518: Predefined type 'System.String' is not defined or imported
(13,66): error CS0518: Predefined type 'System.String' is not defined or imported
(13,17): error CS0518: Predefined type 'System.Object' is not defined or imported
(13,17): error CS0246: The type or namespace name 'TranslationResult' could not be found (are you missing a using directive or an assembly reference?)
(10,22): error CS0115: 'X56819d642671446b9a122640e3fcde24.Terminate()': no suitable method found to override
(8,109): error CS0518: Predefined type 'System.Object' is not defined or imported
(8,109): error CS0246: The type or namespace name 'DomainPacket' could not be found (are you missing a using directive or an assembly reference?)
(8,68): error CS0518: Predefined type 'System.Void' is not defined or imported
(8,132): error CS1729: 'DomainExecutable' does not contain a constructor that takes 1 arguments
(15,71): error CS0518: Predefined type 'System.Object' is not defined or imported
(15,71): error CS0234: The type or namespace name 'Web' does not exist in the namespace 'Xeora' (are you missing an assembly reference?)
(15,113): error CS0518: Predefined type 'System.String' is not defined or imported
(15,125): error CS0518: Predefined type 'System.Object' is not defined or imported
(15,125): error CS0103: The name 'DateTime' does not exist in the current context
(16,40): error CS0518: Predefined type 'System.String' is not defined or imported
(15,14): error CS1729: 'object' does not contain a constructor that takes 0 arguments
at Xeora.Web.Manager.Statement.Factory.Compile(String executableName, String codeBlock)
at Xeora.Web.Manager.Statement.Factory.Create(String blockKey, String statement, Boolean parametric)
at Xeora.Web.Manager.Statement.Factory.Get(String blockKey, String statement, Boolean parametric, Boolean cache)
at Xeora.Web.Manager.Statement.Factory.CreateExecutable(IEnumerable`1 domainIdAccessTree, String statementBlockId, String statement, Boolean parametric, Boolean cache)
--- End of inner exception stack trace ---
at Xeora.Web.Directives.Elements.InLineStatement.ExecuteStatement()
at Xeora.Web.Directives.Elements.InLineStatement.PostRender()
at Xeora.Web.Directives.Directive.Render()
at Xeora.Web.Directives.DirectiveCollection.Render(IDirective directive)
Hello,
I have a little problem with .net 5.0. I have a web framework, that parses the c# code and compile it. When it is compiling it is adding the references to the
CSharpCompilation
usingMetadataReference.CreateFromFile(assembly.Location)
It is working normally, however, if the web framework executable compiled to a single file and tries to compile the c# code coming from web framework code using
MetadataReference.CreateFromFile(assembly.Location)
assembly.Location is returning an empty string and it leads to failure. If I skip the empty values of assembly.Location for references, this time it is creating a huge error mention in the title of this issue. the whole output is like,You can also check source code in this URL: https://github.com/xeora/v7-framework/blob/master/src/Xeora.Web.Manager/Statement/Factory.cs
under Compile function.
It was working with dotnet core 3.1 without any problem on both single executable or not. This problem has appeared with .net 5.0
Thanks