-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[mono][ios] MonoAOT crashes when the app uses SQLite library with a DateTime
member in DTO
#98428
Comments
Tagging subscribers to 'os-ios': @steveisok, @akoeplinger, @kotlarmilos Issue DetailsDescriptionWhen an iOS app uses SQLite library with a DTO that has a
The original reported issue dates back to mono/mono#21270 where Mono was crashing with slightly different error message:
and was reported also in: dotnet/maui#20342 This is still reproducible with ReproThis can be verified with a template
dotnet new ios -n "SQLiteDemo" ; cd SQLiteDemo
dotnet add package SQLitePCLRaw.bundle_green --version 2.1.0
dotnet add package sqlite-net-pcl --version 1.8.0-beta
namespace SQLiteDemo;
using SQLite;
using System.Linq;
public interface ICacheDto
{
string Type { get; set; }
DateTime Date { get; set; }
string Id { get; set; }
}
public sealed class CacheDto : ICacheDto
{
public string Type { get; set; }
public DateTime Date { get; set; }
public string Id { get; set; }
}
public class Demo
{
public static void Crash()
{
var databasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "MyData.db");
if (File.Exists(databasePath))
{
File.Delete(databasePath);
}
var db = new SQLiteConnection(databasePath);
db.CreateTable<CacheDto>();
AddCache(db, "test");
var stocks = db.Table<CacheDto>().Cast<ICacheDto>();
foreach (var stock in stocks)
{
Console.WriteLine("Where StartsWith: t " + stock?.Type);
}
}
public static void AddCache(SQLiteConnection db, string type) {
var stock = new CacheDto() {
Type = type,
Id = Guid.NewGuid().ToString(),
};
db.Insert(stock);
}
}
...
Window.MakeKeyAndVisible ();
Demo.Crash();
Workarounds
<UseInterpreter>true</UseInterpreter> Additional notes
I assume we are again hitting the problem of heavy use of generics and arbitrary delegates which are not AOT friendly. /cc: @vargaz
|
This is not supposed to happen, because we generate gsharedvt version for these wrappers which can handle any type in theory. |
Probably also related: praeclarum/sqlite-net#1067 |
Description
When an iOS app uses SQLite library with a DTO that has a
DateTime
member and tries to iterate over the collection of such objects, it crashes with:The original reported issue dates back to mono/mono#21270 where Mono was crashing with slightly different error message:
and was reported also in: dotnet/maui#20342
This is still reproducible with
net8.0
release.Repro
This can be verified with a template
net8.0-ios
app :Demo.cs
:AppDelegate.cs
Workarounds
Additional notes
public DateTime Date { get; set; }
member from DTO, the app does not crash.I assume we are again hitting the problem of heavy use of generics and arbitrary delegates which are not AOT friendly.
/cc: @vargaz
The text was updated successfully, but these errors were encountered: