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

Microsoft.VisualBasic.Core.Tests fails on iOS and tvOS #51392

Open
mdh1418 opened this issue Apr 16, 2021 · 6 comments
Open

Microsoft.VisualBasic.Core.Tests fails on iOS and tvOS #51392

mdh1418 opened this issue Apr 16, 2021 · 6 comments
Assignees
Labels
area-Microsoft.VisualBasic disabled-test The test is disabled in source code against the issue os-ios Apple iOS os-tvos Apple tvOS
Milestone

Comments

@mdh1418
Copy link
Member

mdh1418 commented Apr 16, 2021

Microsoft.VisualBasic.Core.Tests
Microsoft.VisualBasic.Tests.InteractionTests.Command

Microsoft.VisualBasic.Core.Tests.dll   Failed: 1

Test collection for Microsoft.VisualBasic.Core.Tests.dll
Microsoft.VisualBasic.Tests.InteractionTests.Command
    Assert.False() Failure\nExpected: False\nActual:   True

test methods hanging:

src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft/VisualBasic/FileIO/FileSystemTests.cs
CopyFile_FileSourceFileName_DestinationFileName_OverwriteFalse
MoveFile_SourceFileName_DestinationFileName_OverwriteFalse
@mdh1418 mdh1418 added os-ios Apple iOS os-tvos Apple tvOS labels Apr 16, 2021
@mdh1418 mdh1418 added this to the 6.0.0 milestone Apr 16, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added area-Microsoft.VisualBasic untriaged New issue has not been triaged by the area owner labels Apr 16, 2021
@ghost
Copy link

ghost commented Apr 16, 2021

Tagging subscribers to this area: @cston
See info in area-owners.md if you want to be subscribed.

Issue Details

Microsoft.VisualBasic.Core.Tests
Microsoft.VisualBasic.Tests.InteractionTests.Command

Microsoft.VisualBasic.Core.Tests.dll   Failed: 1

Test collection for Microsoft.VisualBasic.Core.Tests.dll
Microsoft.VisualBasic.Tests.InteractionTests.Command
    Assert.False() Failure\nExpected: False\nActual:   True

<table>
  <tr>
    <th align="left">Author:</th>
    <td>mdh1418</td>
  </tr>
  <tr>
    <th align="left">Assignees:</th>
    <td>-</td>
  </tr>
  <tr>
    <th align="left">Labels:</th>
    <td>

`area-Microsoft.VisualBasic`, `os-ios`, `os-tvos`, `untriaged`

</td>
  </tr>
  <tr>
    <th align="left">Milestone:</th>
    <td>6.0.0</td>
  </tr>
</table>
</details>

@mdh1418 mdh1418 changed the title Microsoft.VisualBasic.Core.Tests fails on iOS crashes on tvOS Microsoft.VisualBasic.Core.Tests fails on iOS and tvOS Apr 30, 2021
@steveisok steveisok removed the untriaged New issue has not been triaged by the area owner label Jul 6, 2021
@steveisok
Copy link
Member

May push this beyond 6

@kotlarmilos
Copy link
Member

The tests are failing on a device with a SIGSEGV error.

Here is a test case that can reproduce the failure:

using System;
using Microsoft.VisualBasic;

namespace HelloWorld
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            try{
                Information.IsNumeric(new char[] { '1', '2', '3' }); // Bug compatible
            } catch (NullReferenceException) {
                Console.WriteLine($"Error handled!");
            }
        }
    }
}

In general, this issue occurs in both JIT and AOT configurations, while it passes on the Interpreter. The assumption is that there is a missing NULL check in virtual tail call for class interface GetTypeCode.

if (mono_class_is_interface (method->klass)) {
guint32 imt_slot = mono_method_get_imt_slot (method);
emit_imt_argument (cfg, call, call->method, imt_arg);
slot_reg = vtable_reg;
offset = ((gint32)imt_slot - MONO_IMT_SIZE) * TARGET_SIZEOF_VOID_P;
} else {

In the interpreter, there is a CKNULL instruction before the virtual call instruction. If this CKNULL instruction is removed, the failure occurs during this_arg->vtable in the MINT_CALLVIRT_FAST opcode.

MINT_IN_CASE(MINT_CALLVIRT_FAST) {
MonoObject *this_arg;
int slot;
cmethod = (InterpMethod*)frame->imethod->data_items [ip [3]];
return_offset = ip [1];
call_args_offset = ip [2];
this_arg = LOCAL_VAR (call_args_offset, MonoObject*);
slot = (gint16)ip [4];
ip += 5;
// FIXME push/pop LMF
cmethod = get_virtual_method_fast (cmethod, this_arg->vtable, slot);

I didn't manage to find the exact code path that is missing the null check. @vargaz Do you think that the approach is reasonable or could it be something else?

@vargaz
Copy link
Contributor

vargaz commented Jun 6, 2023

The JIT doesn't emit null checks, the sigsegv signal emitted on the null dereference is convered to a NullReferenceException.

@kotlarmilos
Copy link
Member

Good, thank you. This means that theSIGSEGV signal is expected and handled as a NullReferenceException.

@kotlarmilos
Copy link
Member

The tests are passing both locally on a device and on tvOS CI pipeline.

@kotlarmilos kotlarmilos reopened this Jun 6, 2023
@kotlarmilos kotlarmilos modified the milestones: Future, 9.0.0 Jul 13, 2023
@kotlarmilos kotlarmilos added the disabled-test The test is disabled in source code against the issue label Jul 13, 2023
@kotlarmilos kotlarmilos removed this from the 9.0.0 milestone Feb 9, 2024
@kotlarmilos kotlarmilos added this to the Future milestone Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Microsoft.VisualBasic disabled-test The test is disabled in source code against the issue os-ios Apple iOS os-tvos Apple tvOS
Projects
None yet
Development

No branches or pull requests

4 participants