forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[release/6.0] [Mono] Fix uninitialized vtable bug (dotnet#67759)
* Add functional test * Fix vtable setup * Add suggested code changes * Improve arguments ordering Co-authored-by: Simon Rozsival <[email protected]>
- Loading branch information
1 parent
f27251a
commit c3fcafb
Showing
3 changed files
with
85 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...ce_Emulator/AOT_System.IO.Stream/Android.Device_Emulator.Aot_System.IO.Stream.Test.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<RunAOTCompilation>true</RunAOTCompilation> | ||
<MonoForceInterpreter>false</MonoForceInterpreter> | ||
<TestRuntime>true</TestRuntime> | ||
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework> | ||
<MainLibraryFileName>Android.Device_Emulator.Aot_System.IO.Stream.Test.dll</MainLibraryFileName> | ||
<ExpectedExitCode>42</ExpectedExitCode> | ||
<EnableAggressiveTrimming>true</EnableAggressiveTrimming> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="Program.cs" /> | ||
</ItemGroup> | ||
</Project> |
48 changes: 48 additions & 0 deletions
48
src/tests/FunctionalTests/Android/Device_Emulator/AOT_System.IO.Stream/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
#nullable enable | ||
|
||
using System; | ||
using System.IO; | ||
|
||
// https://github.com/dotnet/runtime/issues/67402 | ||
|
||
public static class Program | ||
{ | ||
public static int Main(string[] args) | ||
{ | ||
var stream = new DummyStream(); | ||
var buffer = new byte[stream.Length]; | ||
int read = stream.ReadAsync(buffer, 0, buffer.Length).GetAwaiter().GetResult(); | ||
return read + buffer[0]; | ||
} | ||
|
||
private sealed class DummyStream : System.IO.Stream | ||
{ | ||
protected override void Dispose (bool disposing) => throw new NotImplementedException (); | ||
|
||
public override int Read (byte[] buffer, int offset, int count) | ||
{ | ||
buffer[0] = 41; | ||
return 1; | ||
} | ||
|
||
public override long Seek (long offset, SeekOrigin origin) => 0; | ||
public override void SetLength (long value) {} | ||
public override void Write (byte[] buffer, int offset, int count) {} | ||
public override void Flush () {} | ||
|
||
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback? callback, object? state) | ||
{ | ||
Console.WriteLine("BeginRead"); | ||
return base.BeginRead(buffer, offset, count, callback, state); | ||
} | ||
|
||
public override bool CanRead => true; | ||
public override bool CanSeek => false; | ||
public override bool CanWrite => false; | ||
|
||
public override long Length => 1; | ||
public override long Position { get; set; } = 0; | ||
} | ||
} |