-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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] expression Cannot box IsByRefLike type 'System.ReadOnlySpan`1' #98805
Comments
Tagging subscribers to 'os-ios': @steveisok, @akoeplinger, @kotlarmilos Issue DetailsDescriptionwe are using Reproduction Stepsour source code: internal class SpanJson
{
/// <summary>
/// 一个简单的SpanJson测试用例
/// </summary>
[Test("SpanJson.SimpleSample")]
public static void Run()
{
Person person = new Person { Name = "John Doe", Age = 30 };
//Utf16
{
//Generic
{
var json = JsonSerializer.Generic.Utf16.Serialize(person);
var deserializeData = JsonSerializer.Generic.Utf16.Deserialize<Person>(json);
TestUtility.Check(deserializeData.Name == person.Name && deserializeData.Age == person.Age);
}
//NonGeneric
{
var json = JsonSerializer.NonGeneric.Utf16.Serialize(person);
var deserializeData = JsonSerializer.NonGeneric.Utf16.Deserialize(json, typeof(Person)) as Person;
TestUtility.Check(deserializeData.Name == person.Name && deserializeData.Age == person.Age);
}
}
//Utf8
{
//Generic
{
var bytes = JsonSerializer.Generic.Utf8.Serialize(person);
var deserializeData = JsonSerializer.Generic.Utf8.Deserialize<Person>(bytes);
TestUtility.Check(deserializeData.Name == person.Name && deserializeData.Age == person.Age);
}
//NonGeneric
{
var bytes = JsonSerializer.NonGeneric.Utf8.Serialize(person);
var deserializeData = JsonSerializer.NonGeneric.Utf8.Deserialize(bytes, typeof(Person)) as Person;
TestUtility.Check(deserializeData.Name == person.Name && deserializeData.Age == person.Age);
}
}
}
}
[JsonFormatterGenerator]
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
} Expected behaviorwalk correctly Actual behaviorthrow exception, the stacktrace show below: Regression?we have only try use on .net7, but I think .net8 also have this problem. Known Workaroundsno Configurationios Other informationNo response
|
Tagging subscribers to this area: @BrzVlad, @kotlarmilos Issue DetailsDescriptionwe are using Reproduction Stepsour source code: internal class SpanJson
{
/// <summary>
/// 一个简单的SpanJson测试用例
/// </summary>
[Test("SpanJson.SimpleSample")]
public static void Run()
{
Person person = new Person { Name = "John Doe", Age = 30 };
//Utf16
{
//Generic
{
var json = JsonSerializer.Generic.Utf16.Serialize(person);
var deserializeData = JsonSerializer.Generic.Utf16.Deserialize<Person>(json);
TestUtility.Check(deserializeData.Name == person.Name && deserializeData.Age == person.Age);
}
//NonGeneric
{
var json = JsonSerializer.NonGeneric.Utf16.Serialize(person);
var deserializeData = JsonSerializer.NonGeneric.Utf16.Deserialize(json, typeof(Person)) as Person;
TestUtility.Check(deserializeData.Name == person.Name && deserializeData.Age == person.Age);
}
}
//Utf8
{
//Generic
{
var bytes = JsonSerializer.Generic.Utf8.Serialize(person);
var deserializeData = JsonSerializer.Generic.Utf8.Deserialize<Person>(bytes);
TestUtility.Check(deserializeData.Name == person.Name && deserializeData.Age == person.Age);
}
//NonGeneric
{
var bytes = JsonSerializer.NonGeneric.Utf8.Serialize(person);
var deserializeData = JsonSerializer.NonGeneric.Utf8.Deserialize(bytes, typeof(Person)) as Person;
TestUtility.Check(deserializeData.Name == person.Name && deserializeData.Age == person.Age);
}
}
}
}
[JsonFormatterGenerator]
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
} Expected behaviorwalk correctly Actual behaviorthrow exception, the stacktrace show below: Regression?we have only try use on .net7, but I think .net8 also have this problem. Known Workaroundsno Configurationios Other informationNo response
|
@srxqds I'd expect the type of exception you're getting to occur under full aot mode. Can you double check that you are indeed using the interpreter? |
yes, we use interpreter mode |
@steveisok @BrzVlad could you take time to fix it? |
What is |
the source code you can find here: https://github.com/Tornhoof/SpanJson/blob/3849bc28847e2e3ec6d2474283f512a3315b42ae/SpanJson/JsonSerializer.NonGeneric.cs#L213-L226 it can work on mono execute with jit and coreclr |
anyone can help to solve this problem? |
can you provide a full desktop console project that should fail with interpreter ? |
|
I'm actually not able to reproduce it on this sample with desktop interpreter. I haven't yet tried to port the code to an ios project. |
we are using embed mono in ue, the project is too big to share with you. anyone can help me port the c ode to ios project? |
We've tested this repro on ios device and reproduced this error, based on the iOS sample on the repo and the SpanJsonTest
The final ios sample's Makefile (where modified)
The final ios sample's Program.csproj (where modified)
The final ios sample's Program.cs:
We first build the mono runtime on our Apple Silicon PC with |
We also tested this repro with release/8.0 on iOS device, the runtime did throw exception, though the message is different, but with further check, we believe this exception behavior is consistent with the release/7.0 We added the The runtime exception is like:
|
@BrzVlad can you take time to look up this problem for .net8.0 ? |
we have
hi, @steveisok @BrzVlad you can reproduce by this step |
"In the I hope this helps! If you have any more requests or questions, feel free to ask.
|
Description
we are using
Spanjson
on ios use interp mode, it will throw exception when useexpression
generate deserialize/serialize codeReproduction Steps
our source code:
Expected behavior
walk correctly
Actual behavior
throw exception, the stacktrace show below:
Regression?
we have only try use on .net7, but I think .net8 also have this problem.
Known Workarounds
no
Configuration
ios
Other information
No response
The text was updated successfully, but these errors were encountered: