Open Kl-Li opened 1 year ago
I think it's related to :
And I wonder if this can be solved in System.Linq.Dynamic.Core
Maybe you can create an issue for dotnet ?
Hello, Yesterday I was able to spend some more time. It seems the problem isn't related to the single executable as such but to the RID. Below are my findings:
Running with :
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
The single executable found in the publish directory works as expected. The issue appears if we run the "non single exe file". eg default debug inside the IDE
I also tried running with:
<!-- <PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained> -->
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
and indeed the same issue appears (both in the debug and publish directory this time)
@StefH Due to the above i don't think it's related to the trimming. However from you links I noticed the below: https://learn.microsoft.com/en-us/dotnet/core/deploying/single-file/overview?tabs=cli#api-incompatibility
API | Note -- | -- Assembly.Location | Returns an empty string.From a quick look at the code it seems that Assembly.Location is used (eg https://github.com/zzzprojects/System.Linq.Dynamic.Core/blob/4cc72c4e6387fbeb4cbd493c38df63a618a3809b/src/System.Linq.Dynamic.Core/DefaultAssemblyHelper.cs#L25 Not sure if it's related (since those are APIs incompatibilities with single file deployment) but i thought it's worth mentioning.
I will try and do some more tests/reading and update accordingly.
@Kl-Li Were you able to create a reproducible project for this issue?
Hello, Allow me to start by saying thank you for this library. I believe I have found an issue when migrating some code from .net6.0 to .net7.0. If this is an issue on my end (eg wrong version etc please feel free to correct me)
Description: Changing TargetFramework from net6.0 to net7.0 with SelfContained set to true seems to cause an Unhandled exception. of type: System.IO.FileNotFoundException. Looking at the directory I can see that the file is there but has a different version (please see attached picture).
Exception message: Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'System.ComponentModel.TypeConverter, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. File name: 'System.ComponentModel.TypeConverter, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseComparisonOperator() at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseLogicalAndOrOperator() at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseIn() at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseAndOperator() at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseOrOperator() at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseLambdaOperator() at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseNullCoalescingOperator() at System.Linq.Dynamic.Core.Parser.ExpressionParser.ParseConditionalOperator() at System.Linq.Dynamic.Core.Parser.ExpressionParser.Parse(Type resultType, Boolean createParameterCtor) at System.Linq.Dynamic.Core.DynamicExpressionParser.ParseLambda(Type delegateType, ParsingConfig parsingConfig, Boolean createParameterCtor, ParameterExpression[] parameters, Type resultType, String expression, Object[] values) at System.Linq.Dynamic.Core.DynamicExpressionParser.ParseLambda(ParsingConfig parsingConfig, Boolean createParameterCtor, ParameterExpression[] parameters, Type resultType, String expression, Object[] values) at System.Linq.Dynamic.Core.DynamicExpressionParser.ParseLambda[T,TResult](ParsingConfig parsingConfig, Boolean createParameterCtor, String expression, Object[] values) at Program.Main(String[] args) in ...
Sample code: Sample code can be found here: https://dotnetfiddle.net/wnh2gk
csproj configuration: