Problem with Swift Dictionary in C# / .NET

I can reproduce your problem, both the VC# and also when using the same dll from Elements. i’ve logged an issue for the compiler team.

Thank you very much, let me know if there’s anything I can help with, I’m planning on sending this to production in a week.

Btw, I’d be interested in sharing the scenario if that helps you guys with marketing and such.

bugs://77576 got closed with status fixed.

Fixed for the next beta/next release. As a temporary workaround you can use this version of Swift.dll (and relink your projects against it):

Swift.dll (124.5 KB)

1 Like

thanx, Carlo!

Thank you, I’ll try that out and let you know if it doesn’t work.

One more question, not sure if I should start another thread for it, but I’m trying to add the following code:

precedencegroup PipeFunctions {
    associativity: left
}
infix operator >> : PipeFunctions
func >> <T1, T2, T3>(left: @escaping (T1) -> T2, right: @escaping (T2) -> T3) -> (T1) -> T3 {
    return { right(left($0)) }
}
func >> <T1, T2>(left: T1, right: (T1) -> T2) -> T2 {
    return right(left)
}

So I can be a little more functional, but Fire complains about precedencegroup not existing.
Is it supported in any way?

And why is .map, .filter and .reduce not supported in the Array class?

precedencegroup i don’t believe we support yet. i’ll log an issue. the methods should exist though, in swift arrays, and in sequenced. can you send me the full code where they don’t work?

e.g., this compiles fine for me:

import System.Collections.Generic
import System.Linq
import System.Text

print("The magic happens here.")

let foo: [String] = ["a","b","c"]
let bar = foo.map { s in return s.ToUpper() }
let baz = bar.reduce(5) { (i, s) in return length(s)+i }
let foo2 = foo.filter { s in return s > "a" }

Hi, I tried the workaround, but I’m still getting an issue: Unable to load file or assembly 'Swift, Version=9.0.97.2071, Culture=neutral, PublicKeyToken=3df3cad1b7aa5098' or one of it's dependencies. The located assembly manifest definition does not correspond to the assembly reference. (Exception HRESULT: 0x80131040)
(Or something in those lines, since I’m translating from portuguese to english)

Are you sure your project is referencing the new Swift.dll?

Yes, hence the different error we’re getting now.
I’m guessing the code dll has to be created in conjunction with the Swift.dll.

Well, li’m asking because from the error message, clearly your project somehow still tries to pull in Swift, Version=9.0.97.2071. Do you have any other references that themselves use Swift.dll that maybe need to be recompiled against the new dll?

Tried cleaning and deleting everything from the project related to those 3 DLLs, same error.

Hm. can you send me the full project tree, and the build log (for a rebuild)? SOMEthing must be pulling in the old 9.0.97.2071… dll

Here is the project.
FormsClassLibrary.rar (98.8 KB)

And the build log (I think… our .NET dev is not very bright and I’ve never used .NET myself)
Build log.txt (1.7 KB)

Can i get a log with the verbosity set to at least “Normal”? this one seems tobe taken with Quiet, which emits no useful infos :(.

regardless, i’ll check the project itself in the morning, when i’m back at the computer.

Is this the build log you needed?
msbuild.txt (12.3 KB)

@mh Any news?

Rodrigo,

my apologies for the delay.

i’m confused by the build log, because it seems that the C# project actually fails to compile there.

FALHA da compilaÁ„o.

       "C:\Users\alex_\Documents\Visual Studio 2017\Projects\FormsClassLibrary\FormsClassLibrary.sln" (go destino) (1) ->
       "C:\Users\alex_\Documents\Visual Studio 2017\Projects\FormsClassLibrary\FormsClassLibrary\FormsClassLibrary.csproj" (go destino) (2) ->
         C:\Users\alex_\Documents\Visual Studio 2017\Projects\FormsClassLibrary\FormsClassLibrary\FormsClassLibrary.csproj : error MSB4057: O destino "go" n„o existe no projeto.

but in your description, it builds, but fails at runtime? Maybe the problem why you are still seeing the crash and the mentioning of the old dll version in the crash message is because the actual main executable never actually rebuilt?

i gather from the message that the identifier “go” can’t be found — but i can’t really comment more, sine the projects tie did send and that i did test with last week did compile here…

Also, i don’t see the Elements project being built, in that log? did you build that separately, or as part of the same solution? That is the part of the log i needed to see ;). Maybe it would make sense to have your developer post here himself, rather than proxying, if you’re it familiar with .NET and the tool chain, yourself?

Did you try running the FormsClassLibrary project?
And how do I find the logs on Fire for the Elements project? It only shows “Last build was successful”

Just to clarify, we’re not build the Elements project in the C#/.NET environment, I’m building it on my Mac and adding the 3 DLLs to the C# project.