Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xamarin Forms .NET Standard 2.0 + Realm 2.1 Problem #1663

Closed
3 tasks
eliasribeiro opened this issue Dec 17, 2017 · 33 comments
Closed
3 tasks

Xamarin Forms .NET Standard 2.0 + Realm 2.1 Problem #1663

eliasribeiro opened this issue Dec 17, 2017 · 33 comments

Comments

@eliasribeiro
Copy link

eliasribeiro commented Dec 17, 2017

Goals

Do Xamarin Forms work with Realm together again, as old version. (Xamarin.Forms PCL + Realm)

Expected Results

Realm installed and configured automaticaly in project Xamarin Forms(2.5) - .NET Standard 2.0.
It looks like Realm does not recognize Xamarin-type projects.

Actual Results

Project Xamarin Forms stopped run when installed Realm even when add manually FodyWeavers.xml.
The project show need lib "System.Runtime.CompilerServices.Unsafe 4.4.0", but i added through nuget. Project install on device, but not open(close immediately).

Steps to Reproduce

VS2017 - 15.5:
1 - Create Xamarin Forms .NET Standard.
2 - In Nuget add Realm (can add Realm.Database e DataBinding).
3 - Create manually FodyWeavers.xml in all project(Droid, iOS and UWP) with content:

4 - Create simple class model inheriting RealmObject.
4 - Run App.
Observation: Realm work with UWP (without Xamarin).

Code Sample

Version of Realm and Tooling

  • Realm Object Server Version: No
  • Flavor:
    • Developer
    • Professional
    • Enterprise
  • Server OS & Version: ? (e.g. CentOS 6)
  • Client SDK Version: Visual Studio 2017 - 15.5.2.
  • Client OS & Version: Windows 10 - Pro - 1709 - Build: 16299.125 (updated)
@nirinchev
Copy link
Member

Do you have a reproduction project that you can share? It'll help us greatly to get to the bottom of this.

@eliasribeiro
Copy link
Author

Hi, follow link to download and how i create project.

Link to Download:
https://mega.nz/#!0EUwUKgL!D08dxCnUSTIB32wKiLljjv3vVZsYSlnc04ayHSbkugk

Link How i create:
https://youtu.be/s-F9C4qKmf8
(basic create, i not installed Realm.Database and Realm.DataBinding. if you install, do not work too).

Thank you.

@listepo-alterpost
Copy link

I have the same problem

@toumir
Copy link

toumir commented Dec 21, 2017

I experience the same problem

  • Visual studio 2017 ver 15.5.2
  • Xamarin forms .net standard 2
    application works fine without realm, but when referencing realm the application not starting at all ???
    any suggestions?

@listepo-alterpost
Copy link

listepo-alterpost commented Dec 22, 2017

related issue xamarin/AndroidSupportComponents#75 (comment)

@nirinchev
Copy link
Member

@toumir has posted a temporary solution on the forums thread. It's holidays, so it's unlikely we'll be able to provide an "official" one before the start of the new year, so if you're blocked by this issue, you could give it a try.

Thanks @toumir for taking the time to research the issue and provide a hot fix!

@toumir
Copy link

toumir commented Dec 27, 2017

I did that just to not get stuck

@listepo-alterpost
Copy link

@nirinchev is there any news when this bug fix will be in the next release?

Shaddix added a commit to Rubius/Realmius that referenced this issue Jan 4, 2018
MessagingSystem app compiles and run, but can't connect to the server due to realm/realm-dotnet#1663
@listepo-alterpost
Copy link

There is still no news:(

@amasasi
Copy link

amasasi commented Jan 27, 2018

Any news?

@jasonctoms
Copy link

Can we get a little news on the status of this issue? It is a bit of a showstopper and it would be nice to know that it will be fixed soon.

@nirinchev
Copy link
Member

I understand that this is annoying, but we don't have any news as of yet. It appears that it's a bug with Xamarin Android and it's unlikely we'll be able to do anything about it. You either have to use the workaround provided in the comment or wait until the Xamarin team fixes it.

@jasonctoms
Copy link

I don't think it is just with Xamarin Android, as my Android projects build fine and my iOS projects are having the issue. The workaround is less than ideal for enterprise software since it is a "random" dll. I can give it a try though, it would just be nice to know that the Xamarin team is working on something official with some kind of ETA.

@nirinchev
Copy link
Member

I haven't been able to reproduce it with Xamarin.iOS. Is your issue with the unsafe package? If so, definitely open an issue against Xamarin.iOS so they are aware of it and address it quickly. If it's similar to the issue outlined in the forums thread, we have a fix for it and you can get it with the prerelease version of the realm SDK.

@jasonctoms
Copy link

@nirinchev I have just tried using the SdvWeaver .dll from the forum post and it does seem to fix my issue with Xamarin.iOS. We have a modular solution that is a mix between (now) .NET Standard 2.0 projects and Xamarin.iOS/Xamarin.Android projects. My Xamarin.Android app was building fine, and it uses the same .NET Standard 2.0 projects as the Xamarin.iOS app, which is why I assumed the issue was in iOS.

I can see the prerelease package as well, but it seems like the official release should be out relatively soon. So I can just use the workaround dll for development and just hold off on our releases. Thank you for the replies :)

@nirinchev
Copy link
Member

While we can't make promises, I expect an official release will land in the next 1-2 weeks (there's a major feature I'd like to push with the next release, which is why it has been delayed a little). Glad to hear you're unblocked and sorry that it has taken us so long to push an official fix.

@listepo-alterpost
Copy link

@nirinchev We look forward to the new release

@listepo-alterpost
Copy link

@nirinchev I apologize, I want to remind you that two weeks have passed, and still no release :(

@nirinchev
Copy link
Member

@HideDev do you have issues with Android or iOS? If it's the Android issue mentioned with CompilerServices.Unsafe, there's nothing we can do - it's a bug with Xamarin Android that affects all libraries that depend on this package and must be fixed by the Xamarin team. If you are facing issues with iOS/UWP builds, then the prerelease we published on myget should address those.

@listepo-alterpost
Copy link

@nirinchev thanks

@augustoparma
Copy link

augustoparma commented Mar 1, 2018

Hi everybody!
I am dealing with the same issue with Android, and planning to extend the project to IOS.
Deadlines are quite strict, so the options are: waiting for a fix by the Xamarin team or go back to SQLite and, at least, make the project work.
Any clue about the bug fix release date?
Thank you.

@nirinchev
Copy link
Member

Do you have an issue with CompilerServices.Unsafe on Android? If so, then SQLite is also affected and I'm not sure how you can go back to it.

@augustoparma
Copy link

Nope, the CompilerServices.Unsafe issue was solved by deleting all Fody and Realm packages and by reinstalling Realm. The actual issue is due by the following warning that causes a deployment error:

The referenced component '...nuget\packages\realm\2.1.0\build..\native..\runtimes\osx.10.10-x64\native\librealm-wrappers.dylib' could not be found.
The referenced component '...nuget\packages\realm\2.1.0\build..\native\ios\universal\librealm-wrappers.a' could not be found.

@nirinchev
Copy link
Member

This is not the same error and makes it hard to keep the discussion on topic. Can you create a new issue and we can look into it.

@augustoparma
Copy link

Ok, i solved all the reported warning. The problem is that now the CompilerServices.Unsafe issue is back, or maybe never solved but just hidden.
So is the only way to wait for a Xamarin bugfix? If the solution time is of SOME DAYS order it is ok to wait, otherwise I am undefinitely stuck. Confirm?

@nirinchev
Copy link
Member

If it's the CompilerServices.Unsafe issue, then SQLite, Realm, and virtually any library that uses native code is affected. There are some workarounds posted in the Xamarin.Android issue, e.g. this one: dotnet/android#1162 (comment).

@NokautBR
Copy link

NokautBR commented Mar 3, 2018

Overwrite the System.Runtime.CompilerServices.Unsafe.dll to correct version (folder .../obj/debug i think). Maybe it`s a bug from Visual Studio. The correct version you will find on Nuget package. Cleaning the project will not work, because Visual Studio creates wrong dll version everytime that dll is removed.

@phamquan
Copy link

I think back to 2.0.0 is not a bad option in comparision to your important release deadline 😄

@SaoryEmanoelle
Copy link

Any news on this?

@nirinchev
Copy link
Member

As mentioned a few times, this is a Xamarin issue tracked in dotnet/android#1162. It appears it's been resolved, so I expect it will be released soon.

@SaoryEmanoelle
Copy link

Thank you very much!

@nirinchev
Copy link
Member

I'm closing this issue as the parent one seems to be closed and a release is expected shortly. If it still happens after the new version of Xamarin.Android is released, I'll reopen.

@vidiep
Copy link

vidiep commented Apr 25, 2018

I can't connect xamrin froms to realm object server

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests