Won't build in Elements C# - does in MS C#


(Chris) #1

I have a test project that I can’t get to build in Water and Elements C#. I created the same project in VS 2017 using MS C# and it builds/runs fine. I also created the same project in VS 2017 using Elements C# and it fails to build, giving the same error as in Water.

I have attached both the Water/Elements C# project and the VS/MS C# project to this post.

If I comment out the following line in Form1.cs it will build/run

.Where($"{nameof(Recipient.RecipientName):C}=@NameParam")

The error has something to do with FormattableString

Here is the build log:

"C:\Program Files (x86)\RemObjects Software\Elements\Bin\EBuild.exe" C:\devdata\water\testing\formatted-string-test\dapper-multi-db-test.sln --logger:fire --configuration:Debug --verbosity:normal --xml:C:\devdata\water\testing\formatted-string-test\obj\dapper-multi-db-test.water.xml --build --setting:TreatFixableErrorsAsWarnings=True
RemObjects EBuild. An open source build engine for Elements and beyond.
Copyright RemObjects Software 2016-2018. All Rights Reserved. Created by marc hoffman.
Version 10.0.0.2337 (develop) built on talax, 20181019-174442. Commit e637dd2.

   RemObjects Elements (Oxygene, C#, Swift and Java) Compiler for .NET, Cocoa, Java and Island.
   Version 10.0.0.2337 (develop) built on talax, 20181019-174442. Commit e637dd2.
   Copyright 2003-2018 RemObjects Software, LLC. All rights reserved.
   
   Source file: C:\devdata\water\testing\formatted-string-test\Properties\AssemblyInfo.cs
   Source file: C:\devdata\water\testing\formatted-string-test\Properties\Resources.Designer.cs
   Source file: C:\devdata\water\testing\formatted-string-test\Properties\Settings.Designer.cs
   Source file: C:\devdata\water\testing\formatted-string-test\Form1.cs
   Source file: C:\devdata\water\testing\formatted-string-test\Form1.Designer.cs
   Source file: C:\devdata\water\testing\formatted-string-test\Program.cs
   Resource file: C:\Users\Chris\AppData\Local\RemObjects Software\EBuild\Obj\dapper-multi-db-test-6517456023558B0F44C8DD2C6A5653B6D47D7A19\Debug\Echoes\res\Properties-Resources.resources
   Reference: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\mscorlib.dll
   Reference: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Core.dll
   Reference: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.DataSetExtensions.dll
   Reference: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.dll
   Reference: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.dll
   Reference: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Drawing.dll
   Reference: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Windows.Forms.dll
   Reference: C:\Program Files (x86)\RemObjects Software\Elements\Echoes\Reference Assemblies\NET\Echoes.dll
   Reference: C:\Program Files (x86)\RemObjects Software\Elements\Echoes\Reference Assemblies\NET\Elements.dll
   Reference: C:\Users\Chris\.nuget\packages\dapper.fastcrud\2.5.0.39\lib\net46\Dapper.FastCrud.dll
   Reference: C:\Users\Chris\.nuget\packages\dapper\1.50.5\lib\net451\Dapper.dll
   Reference: C:\Users\Chris\.nuget\packages\EntityFramework\6.2.0\lib\net45\EntityFramework.dll
   Reference: C:\Users\Chris\.nuget\packages\EntityFramework\6.2.0\lib\net45\EntityFramework.SqlServer.dll
   Reference: C:\Users\Chris\.nuget\packages\System.Data.SQLite.Core\1.0.109.2\lib\net46\System.Data.SQLite.dll
   Reference: C:\Users\Chris\.nuget\packages\System.Data.SQLite.EF6\1.0.109\lib\net46\System.Data.SQLite.EF6.dll
   Reference: C:\Users\Chris\.nuget\packages\System.Data.SQLite.Linq\1.0.109\lib\net46\System.Data.SQLite.Linq.dll
   Reference: C:\Windows\assembly\GAC_MSIL\RemObjects.Elements.Cirrus\10.0.0.2337__3df3cad1b7aa5098\RemObjects.Elements.Cirrus.dll
E: Parameter 1 is "RemObjects.Elements.RTL.String!", should be "FormattableString", in call to TStatementOptionsBuilder Dapper.FastCrud.Configuration.StatementOptions.IConditionalSqlStatementOptionsOptionsSetter<Recipient,Dapper.FastCrud.Configuration.StatementOptions.Builders.IRangedBatchSelectSqlSqlStatementOptionsOptionsBuilder<Recipient>>.Where(FormattableString whereClause) [C:\devdata\water\testing\formatted-string-test\Form1.cs (36)]
   Project 'dapper-multi-db-test' failed to build.
   Solution 'dapper-multi-db-test' failed to build all projects.

I’ve tried my best type-casting vodoo, but can’t get rid of the error. I think it might be a compiler problem.

Edit: Couldn’t upload - too big. Here are links:
Water/Elements C# version
VS/MS C# version


(RemObjects) #2

Thanks, logged as bugs://81291


(marc hoffman) #3

Thanx. looks like that’s a variation of the interpolated string syntax we don’t fully support yet — I’ve logged a feature request. Try dropping the :C — what does that do?


(RemObjects) #4

bugs://81291 got closed with status fixed.


(Chris) #5

Dropping the :C doesn’t change anything. Not sure if you still need to know that or not, but there it is.


(marc hoffman) #6

K. whatever it was, Carlo seems to have figured it out and fixed it for Friday’s build.


(Chris) #7

I just downloaded the latest weekly beta build: .2339 but unfortunately I’m still getting the same build error described in the first post above. The attached Elements test project still won’t build in either Water or VS, but the MS C# one will in VS.


(Chris) #8

Here is a real simple test project to show the problem.

Just create a new Elements C# Console App project in Water or VS, and then create another in Microsoft C# (can only do this in VS).

Paste in this for Program.cs

using System;

namespace simpleformattablestringtest
{
    static class Program
    {
        public void Main(string[] args)
        {
            double speedOfLight = 299792.458;
            FormattableString message = $"The speed of light is {speedOfLight:N3} km/s.";
            Console.WriteLine(message);
        }
    }
}

Compiles with MS compiler but not Elements compiler :frowning:


(Chris) #9

One more note. If I remove the 'Default “uses” Clause from the Settings screen for the project (it is normally set to RemObjects.Elements.RTL), and don’t add it back in to the code file as a ‘using’ clause, the program will compile and run.

I think that is because it is now using the .NET string types, instead of the Elements string types.


(Carlo Kok) #10

ah! Yes sorry about that. I’ll see if i can make it work with Elements RTL “String” too, it currently only works with System.String.


(Chris) #11

Since there is a very easy work around, don’t make it a high priority on my account.


(Carlo Kok) #12

fixed for v-next.