[CSHARP-4389] MongoDBDriver latest version 2.18.0 breaks compiling Xamarin iOS Created: 28/Oct/22  Updated: 27/Oct/23  Resolved: 28/Oct/22

Status: Closed
Project: C# Driver
Component/s: Build
Affects Version/s: 2.11.0-beta1, 2.11.0-beta2, 2.11.0, 2.11.1, 2.11.2, 2.11.3, 2.11.4, 2.11.5, 2.11.6, 2.12.0, 2.12.1, 2.12.2, 2.12.3, 2.12.4, 2.12.5, 2.13.0, 2.13.1, 2.13.2, 2.13.3, 2.14.0, 2.15.0, 2.15.1, 2.16.0, 2.16.1, 2.17.0, 2.17.1, 2.18.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Martien Poels Assignee: Dmitry Lukyanov (Inactive)
Resolution: Works as Designed Votes: 0
Labels: Bug
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CSHARP-3178 MongoDB.Driver latest version 2.11 br... Closed
Quarter: FY22YYQ4

 Description   

Summary

Can not compile Xamarin ioS when MongDB.Bson.Driver is included in project

Error: error MT0009: Error while loading assemblies: /Users/user229415/Library/Caches/Xamarin/mtbs/builds/ShowPrices.iOS/684e3026490069e9d81d0578e2a798e556b400b3f827e95398229ca2c78a936b/bin/iPhoneSimulator/Debug/mongocrypt.dll.

If I downgrade to driver 2.10.4 the problem disappears. There was a bug fix in 2.11.4 but that one gives error too.

Reproduce create xamarin forms application with ios support. Add the package MongoDB.Driver, compile and voila problem.

I need that driver because I need the definitions in classes I use, the application itself does not make a mongodb connection. I can run the application using 2.10.4 but the lib that has that driver is also used elsewhere and then the most recent version is essential. So this really is a killer now!!

Environment VisualStudio: 17.3.6
Buildagent: 17.3.0.308
MacOS Ventura Xcode 13.2,1



 Comments   
Comment by Martien Poels [ 28/Oct/22 ]

Hi Dmitry,

I have fixed it as suggested in my production project and that one is running now too. It had become messy because of the foreign include of the iosStuff. Thanks for helping.
I must admit I have developed several android apps and this app is the first having to do both, so Ios is kind of new too me. So this was a steep digg-in session.
But everything is running now. I few images are not correct but for the rest it looks good already. Made a lot of progress today.

Happy weekend, and thanks for the excellent and rapid response. You may close the bug report and mark it as fixed.

Met vriendelijke groet/with kind regards,

Martien Poels
Founder / CTO

[Bank 2 Loyalty]
Contactless technologies bv
Keizersveld 50
5803 AN Venray
The Netherlands
martien.poels@bank2loyalty.com<martien.poels@bank2loyalty.com>
www.bank2loyalty.com<http://www.bank2loyalty.com/>
+31 (0) 478 206900<tel:+314787206900>

From: Dmitry Lukyanov (Jira) <jira@mongodb.org>
Sent: Friday, October 28, 2022 3:52 PM
To: Martien Poels <martien.poels@bank2loyalty.com>
Subject: [MongoDB-JIRA] (CSHARP-4389) MongoDBDriver latest version 2.18.0 breaks compiling Xamarin iOS

https://jira.mongodb.org/s/en_USp8swtz-1988229788/6109/25/_/jira-logo-scaled.png
[cid:image001.png@01D8EAF3.45CC0260]
Dmitry Lukyanov<https://jira.mongodb.org/secure/ViewProfile.jspa?name=dmitry.lukyanov%40mongodb.com> edited a comment on [Bug] CSHARP-4389<https://jira.mongodb.org/browse/CSHARP-4389>

Re: MongoDBDriver latest version 2.18.0 breaks compiling Xamarin iOS<https://jira.mongodb.org/browse/CSHARP-4389>
The issue here is that xamarin ios doesn't correctly determine RID and try to use windows binary. This is why you see "mongocrypt.dll" (with .dll instead .dylib) in the exception. If you still see the same error message, I would suggest asking it in mentioned [ msbuid |https: / /github.com/dotnet/msbuild/issues/6072] / [ mono |https: / /github.com/mono/mono/issues/15569] / [ xamarin |https://github.com/xamarin/xamarin-macios/ issues /10337] issues .
[Add Comment]<https://jira.mongodb.org/browse/CSHARP-4389#add-comment>
Add Comment<https://jira.mongodb.org/browse/CSHARP-4389#add-comment>

This message was sent from MongoDB's issue tracking system. To respond to this ticket, please login to jira.mongodb.org<https://jira.mongodb.org> using your JIRA, MongoDB Cloud Manager, or MongoDB Atlas credentials.

Comment by Dmitry Lukyanov (Inactive) [ 28/Oct/22 ]

The issue here is that xamarin ios doesn't correctly determine RID and try to use windows binary. This is why you see "mongocrypt.dll" (with .dll instead .dylib) in the exception. If you still see the same error message, I would suggest asking it in mentioned msbuid / mono / xamarin issues.

Comment by Martien Poels [ 28/Oct/22 ]

Hi Dmitry,

If fixed the issue in a test project, but not in my real project. However I must admit I have added the iOS section later by creating a project with the exact same name and then copied it to the target project. At least it gives an idea where to search for.

Met vriendelijke groet/with kind regards,

Martien Poels
Founder / CTO

[Bank 2 Loyalty]
Contactless technologies bv
Keizersveld 50
5803 AN Venray
The Netherlands
martien.poels@bank2loyalty.com<martien.poels@bank2loyalty.com>
www.bank2loyalty.com<http://www.bank2loyalty.com/>
+31 (0) 478 206900<tel:+314787206900>

From: Dmitry Lukyanov (Jira) <jira@mongodb.org>
Sent: Friday, October 28, 2022 12:06 PM
To: Martien Poels <martien.poels@bank2loyalty.com>
Subject: [MongoDB-JIRA] (CSHARP-4389) MongoDBDriver latest version 2.18.0 breaks compiling Xamarin iOS

https://jira.mongodb.org/s/en_USp8swtz-1988229788/6109/25/_/jira-logo-scaled.png
[cid:image001.png@01D8EAD4.DDA45390]
Dmitry Lukyanov<https://jira.mongodb.org/secure/ViewProfile.jspa?name=dmitry.lukyanov%40mongodb.com> edited a comment on [Bug] CSHARP-4389<https://jira.mongodb.org/browse/CSHARP-4389>

Re: MongoDBDriver latest version 2.18.0 breaks compiling Xamarin iOS<https://jira.mongodb.org/browse/CSHARP-4389>
Hey martien.poels@bank2loyalty.com , this looks like the same msbuild issue as in CSHARP-3178. Try solution from this thread and this [ comment |https://jira . mongodb.org/browse/CSHARP-3277?focusedCommentId=3680327&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-3680327].
[Add Comment]<https://jira.mongodb.org/browse/CSHARP-4389#add-comment>
Add Comment<https://jira.mongodb.org/browse/CSHARP-4389#add-comment>

This message was sent from MongoDB's issue tracking system. To respond to this ticket, please login to jira.mongodb.org<https://jira.mongodb.org> using your JIRA, MongoDB Cloud Manager, or MongoDB Atlas credentials.

Comment by Martien Poels [ 28/Oct/22 ]

Hi Dmitry,

That was indeed the solution to add those two lines in the projectfile resolved the issue!!
Maybe it should state more clearly that you should add it this way:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns=http://schemas.microsoft.com/developer/msbuild/2003>
…….
<PropertyGroup>
<RuntimeIdentifiers>osx;osx-x86;osx-x64</RuntimeIdentifiers>
<NuGetRuntimeIdentifier>osx</NuGetRuntimeIdentifier>
</PropertyGroup>
….

But many thanks, now I can proceed with the project.

Met vriendelijke groet/with kind regards,

Martien Poels
Founder / CTO

[Bank 2 Loyalty]
Contactless technologies bv
Keizersveld 50
5803 AN Venray
The Netherlands
martien.poels@bank2loyalty.com<martien.poels@bank2loyalty.com>
www.bank2loyalty.com<http://www.bank2loyalty.com/>
+31 (0) 478 206900<tel:+314787206900>

From: Dmitry Lukyanov (Jira) <jira@mongodb.org>
Sent: Friday, October 28, 2022 12:06 PM
To: Martien Poels <martien.poels@bank2loyalty.com>
Subject: [MongoDB-JIRA] (CSHARP-4389) MongoDBDriver latest version 2.18.0 breaks compiling Xamarin iOS

https://jira.mongodb.org/s/en_USp8swtz-1988229788/6109/25/_/jira-logo-scaled.png
[cid:image001.png@01D8EAD2.6FF8FCD0]
Dmitry Lukyanov<https://jira.mongodb.org/secure/ViewProfile.jspa?name=dmitry.lukyanov%40mongodb.com> edited a comment on [Bug] CSHARP-4389<https://jira.mongodb.org/browse/CSHARP-4389>

Re: MongoDBDriver latest version 2.18.0 breaks compiling Xamarin iOS<https://jira.mongodb.org/browse/CSHARP-4389>
Hey martien.poels@bank2loyalty.com , this looks like the same msbuild issue as in CSHARP-3178. Try solution from this thread and this [ comment |https://jira . mongodb.org/browse/CSHARP-3277?focusedCommentId=3680327&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-3680327].
[Add Comment]<https://jira.mongodb.org/browse/CSHARP-4389#add-comment>
Add Comment<https://jira.mongodb.org/browse/CSHARP-4389#add-comment>

This message was sent from MongoDB's issue tracking system. To respond to this ticket, please login to jira.mongodb.org<https://jira.mongodb.org> using your JIRA, MongoDB Cloud Manager, or MongoDB Atlas credentials.

Comment by Dmitry Lukyanov (Inactive) [ 28/Oct/22 ]

Hey martien.poels@bank2loyalty.com , this looks like the same msbuild issue as in CSHARP-3178. Try solution from this thread and this comment.

Generated at Wed Feb 07 21:48:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.