-
Couldn't load subscription status.
- Fork 5.2k
Closed
Labels
area-Codegen-LLVM-monoin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Description
From @jeromelaban on Wed, 18 Dec 2024 15:09:40 GMT
Apple platform
iOS, macOS, Mac Catalyst, tvOS
Framework version
net9.0-*
Affected platform version
9.0.101
Description
When a class contains two consecutive Vector3 fields, setting the value for the first will modify the first inner field (X) of the second field.
Steps to Reproduce
Add the following code to an app, then run, the error message should not happen:
public partial class MyTestClass
{
private Vector3 _offset;
private Vector3 _scale = new Vector3(1, 1, 1);
internal static void RunTest()
{
var v1 = new MyTestClass();
System.Console.WriteLine($"Scale: {v1.Scale} Offset: {v1.Offset} Scale: {v1.Scale}");
var v2 = new MyTestClass() { Offset = new(1.1f, 1.1f, 5.0f) };
System.Console.WriteLine($"Scale: {v2.Scale} Offset: {v2.Offset} Scale: {v2.Scale}");
if(v2.Scale != new Vector3(1, 1, 1))
{
System.Console.WriteLine("Error: Scale is not 1, 1, 1");
}
}
public Vector3 Offset
{
get => _offset;
set
{
System.Console.WriteLine($"Before Offset: {Offset} Scale: {Scale}");
_offset = value;
System.Console.WriteLine($"After Offset: {Offset} Scale: {Scale}");
}
}
public Vector3 Scale => _scale;
}Repro project: 21825-iosllvmissue.zip
Did you find any workaround?
Adding a field of another type in between seems to works around the issue.
Relevant logs
No response
Copied from original issue dotnet/macios#21825
carldebilly
Metadata
Metadata
Assignees
Labels
area-Codegen-LLVM-monoin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged