repo_name
stringclasses
6 values
pr_number
int64
512
78.9k
pr_title
stringlengths
3
144
pr_description
stringlengths
0
30.3k
author
stringlengths
2
21
date_created
timestamp[ns, tz=UTC]
date_merged
timestamp[ns, tz=UTC]
previous_commit
stringlengths
40
40
pr_commit
stringlengths
40
40
query
stringlengths
17
30.4k
filepath
stringlengths
9
210
before_content
stringlengths
0
112M
after_content
stringlengths
0
112M
label
int64
-1
1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/tests/JIT/HardwareIntrinsics/General/Vector128/EqualsAny.SByte.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void EqualsAnySByte() { var test = new VectorBooleanBinaryOpTest__EqualsAnySByte(); // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); // Validates passing a static member works test.RunClsVarScenario(); // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); // Validates passing the field of a local class works test.RunClassLclFldScenario(); // Validates passing an instance member of a class works test.RunClassFldScenario(); // Validates passing the field of a local struct works test.RunStructLclFldScenario(); // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorBooleanBinaryOpTest__EqualsAnySByte { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private GCHandle inHandle1; private GCHandle inHandle2; private ulong alignment; public DataTable(SByte[] inArray1, SByte[] inArray2, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<SByte>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<SByte>(); if ((alignment != 32 && alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<SByte, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<SByte, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<SByte> _fld1; public Vector128<SByte> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref testStruct._fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref testStruct._fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); return testStruct; } public void RunStructFldScenario(VectorBooleanBinaryOpTest__EqualsAnySByte testClass) { var result = Vector128.EqualsAny(_fld1, _fld2); testClass.ValidateResult(_fld1, _fld2, result); } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte); private static SByte[] _data1 = new SByte[Op1ElementCount]; private static SByte[] _data2 = new SByte[Op2ElementCount]; private static Vector128<SByte> _clsVar1; private static Vector128<SByte> _clsVar2; private Vector128<SByte> _fld1; private Vector128<SByte> _fld2; private DataTable _dataTable; static VectorBooleanBinaryOpTest__EqualsAnySByte() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); } public VectorBooleanBinaryOpTest__EqualsAnySByte() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } _dataTable = new DataTable(_data1, _data2, LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Vector128.EqualsAny( Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<SByte>>(_dataTable.inArray2Ptr) ); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, result); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var method = typeof(Vector128).GetMethod(nameof(Vector128.EqualsAny), new Type[] { typeof(Vector128<SByte>), typeof(Vector128<SByte>) }); if (method is null) { method = typeof(Vector128).GetMethod(nameof(Vector128.EqualsAny), 1, new Type[] { typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)) }); } if (method.IsGenericMethodDefinition) { method = method.MakeGenericMethod(typeof(SByte)); } var result = method.Invoke(null, new object[] { Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<SByte>>(_dataTable.inArray2Ptr) }); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, (bool)(result)); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Vector128.EqualsAny( _clsVar1, _clsVar2 ); ValidateResult(_clsVar1, _clsVar2, result); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<SByte>>(_dataTable.inArray2Ptr); var result = Vector128.EqualsAny(op1, op2); ValidateResult(op1, op2, result); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorBooleanBinaryOpTest__EqualsAnySByte(); var result = Vector128.EqualsAny(test._fld1, test._fld2); ValidateResult(test._fld1, test._fld2, result); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Vector128.EqualsAny(_fld1, _fld2); ValidateResult(_fld1, _fld2, result); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Vector128.EqualsAny(test._fld1, test._fld2); ValidateResult(test._fld1, test._fld2, result); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } private void ValidateResult(Vector128<SByte> op1, Vector128<SByte> op2, bool result, [CallerMemberName] string method = "") { SByte[] inArray1 = new SByte[Op1ElementCount]; SByte[] inArray2 = new SByte[Op2ElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), op2); ValidateResult(inArray1, inArray2, result, method); } private void ValidateResult(void* op1, void* op2, bool result, [CallerMemberName] string method = "") { SByte[] inArray1 = new SByte[Op1ElementCount]; SByte[] inArray2 = new SByte[Op2ElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<SByte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<SByte>>()); ValidateResult(inArray1, inArray2, result, method); } private void ValidateResult(SByte[] left, SByte[] right, bool result, [CallerMemberName] string method = "") { bool succeeded = true; var expectedResult = false; for (var i = 0; i < Op1ElementCount; i++) { expectedResult |= (left[i] == right[i]); } succeeded = (expectedResult == result); if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector128)}.{nameof(Vector128.EqualsAny)}<SByte>(Vector128<SByte>, Vector128<SByte>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({result})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void EqualsAnySByte() { var test = new VectorBooleanBinaryOpTest__EqualsAnySByte(); // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); // Validates passing a static member works test.RunClsVarScenario(); // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); // Validates passing the field of a local class works test.RunClassLclFldScenario(); // Validates passing an instance member of a class works test.RunClassFldScenario(); // Validates passing the field of a local struct works test.RunStructLclFldScenario(); // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorBooleanBinaryOpTest__EqualsAnySByte { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private GCHandle inHandle1; private GCHandle inHandle2; private ulong alignment; public DataTable(SByte[] inArray1, SByte[] inArray2, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<SByte>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<SByte>(); if ((alignment != 32 && alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<SByte, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<SByte, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<SByte> _fld1; public Vector128<SByte> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref testStruct._fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref testStruct._fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); return testStruct; } public void RunStructFldScenario(VectorBooleanBinaryOpTest__EqualsAnySByte testClass) { var result = Vector128.EqualsAny(_fld1, _fld2); testClass.ValidateResult(_fld1, _fld2, result); } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte); private static SByte[] _data1 = new SByte[Op1ElementCount]; private static SByte[] _data2 = new SByte[Op2ElementCount]; private static Vector128<SByte> _clsVar1; private static Vector128<SByte> _clsVar2; private Vector128<SByte> _fld1; private Vector128<SByte> _fld2; private DataTable _dataTable; static VectorBooleanBinaryOpTest__EqualsAnySByte() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); } public VectorBooleanBinaryOpTest__EqualsAnySByte() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } _dataTable = new DataTable(_data1, _data2, LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Vector128.EqualsAny( Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<SByte>>(_dataTable.inArray2Ptr) ); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, result); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var method = typeof(Vector128).GetMethod(nameof(Vector128.EqualsAny), new Type[] { typeof(Vector128<SByte>), typeof(Vector128<SByte>) }); if (method is null) { method = typeof(Vector128).GetMethod(nameof(Vector128.EqualsAny), 1, new Type[] { typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)) }); } if (method.IsGenericMethodDefinition) { method = method.MakeGenericMethod(typeof(SByte)); } var result = method.Invoke(null, new object[] { Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<SByte>>(_dataTable.inArray2Ptr) }); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, (bool)(result)); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Vector128.EqualsAny( _clsVar1, _clsVar2 ); ValidateResult(_clsVar1, _clsVar2, result); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<SByte>>(_dataTable.inArray2Ptr); var result = Vector128.EqualsAny(op1, op2); ValidateResult(op1, op2, result); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorBooleanBinaryOpTest__EqualsAnySByte(); var result = Vector128.EqualsAny(test._fld1, test._fld2); ValidateResult(test._fld1, test._fld2, result); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Vector128.EqualsAny(_fld1, _fld2); ValidateResult(_fld1, _fld2, result); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Vector128.EqualsAny(test._fld1, test._fld2); ValidateResult(test._fld1, test._fld2, result); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } private void ValidateResult(Vector128<SByte> op1, Vector128<SByte> op2, bool result, [CallerMemberName] string method = "") { SByte[] inArray1 = new SByte[Op1ElementCount]; SByte[] inArray2 = new SByte[Op2ElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), op2); ValidateResult(inArray1, inArray2, result, method); } private void ValidateResult(void* op1, void* op2, bool result, [CallerMemberName] string method = "") { SByte[] inArray1 = new SByte[Op1ElementCount]; SByte[] inArray2 = new SByte[Op2ElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<SByte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<SByte>>()); ValidateResult(inArray1, inArray2, result, method); } private void ValidateResult(SByte[] left, SByte[] right, bool result, [CallerMemberName] string method = "") { bool succeeded = true; var expectedResult = false; for (var i = 0; i < Op1ElementCount; i++) { expectedResult |= (left[i] == right[i]); } succeeded = (expectedResult == result); if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector128)}.{nameof(Vector128.EqualsAny)}<SByte>(Vector128<SByte>, Vector128<SByte>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({result})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/coreclr/tools/Common/Compiler/Logging/ReferenceSource/MessageContainer.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Reflection; using System.Text; using ILLink.Shared; using Mono.Cecil; namespace Mono.Linker { public readonly struct MessageContainer : IComparable<MessageContainer>, IEquatable<MessageContainer> { public static readonly MessageContainer Empty; /// <summary> /// Optional data with a filename, line and column that triggered the /// linker to output an error (or warning) message. /// </summary> public MessageOrigin? Origin { get; } public MessageCategory Category { get; } /// <summary> /// Further categorize the message. /// </summary> public string SubCategory { get; } /// <summary> /// Code identifier for errors and warnings reported by the IL linker. /// </summary> public int? Code { get; } /// <summary> /// User friendly text describing the error or warning. /// </summary> public string Text { get; } /// <summary> /// Create an error message. /// </summary> /// <param name="text">Humanly readable message describing the error</param> /// <param name="code">Unique error ID. Please see https://github.com/dotnet/linker/blob/main/docs/error-codes.md /// for the list of errors and possibly add a new one</param> /// <param name="subcategory">Optionally, further categorize this error</param> /// <param name="origin">Filename, line, and column where the error was found</param> /// <returns>New MessageContainer of 'Error' category</returns> internal static MessageContainer CreateErrorMessage (string text, int code, string subcategory = MessageSubCategory.None, MessageOrigin? origin = null) { if (!(code >= 1000 && code <= 2000)) throw new ArgumentOutOfRangeException (nameof (code), $"The provided code '{code}' does not fall into the error category, which is in the range of 1000 to 2000 (inclusive)."); return new MessageContainer (MessageCategory.Error, text, code, subcategory, origin); } /// <summary> /// Create an error message. /// </summary> /// <param name="origin">Filename, line, and column where the error was found</param> /// <param name="id">Unique error ID. Please see https://github.com/dotnet/linker/blob/main/docs/error-codes.md /// for the list of errors and possibly add a new one</param> /// <param name="args">Additional arguments to form a humanly readable message describing the warning</param> /// <returns>New MessageContainer of 'Error' category</returns> internal static MessageContainer CreateErrorMessage (MessageOrigin? origin, DiagnosticId id, params string[] args) { if (!((int) id >= 1000 && (int) id <= 2000)) throw new ArgumentOutOfRangeException (nameof (id), $"The provided code '{(int) id}' does not fall into the error category, which is in the range of 1000 to 2000 (inclusive)."); return new MessageContainer (MessageCategory.Error, id, origin: origin, args: args); } /// <summary> /// Create a custom error message. /// </summary> /// <param name="text">Humanly readable message describing the error</param> /// <param name="code">A custom error ID. This code should be greater than or equal to 6001 /// to avoid any collisions with existing and future linker errors</param> /// <param name="subcategory">Optionally, further categorize this error</param> /// <param name="origin">Filename or member where the error is coming from</param> /// <returns>Custom MessageContainer of 'Error' category</returns> public static MessageContainer CreateCustomErrorMessage (string text, int code, string subcategory = MessageSubCategory.None, MessageOrigin? origin = null) { #if DEBUG Debug.Assert (Assembly.GetCallingAssembly () != typeof (MessageContainer).Assembly, "'CreateCustomErrorMessage' is intended to be used by external assemblies only. Use 'CreateErrorMessage' instead."); #endif if (code <= 6000) throw new ArgumentOutOfRangeException (nameof (code), $"The provided code '{code}' does not fall into the permitted range for external errors. To avoid possible collisions " + "with existing and future {Constants.ILLink} errors, external messages should use codes starting from 6001."); return new MessageContainer (MessageCategory.Error, text, code, subcategory, origin); } /// <summary> /// Create a warning message. /// </summary> /// <param name="context">Context with the relevant warning suppression info.</param> /// <param name="text">Humanly readable message describing the warning</param> /// <param name="code">Unique warning ID. Please see https://github.com/dotnet/linker/blob/main/docs/error-codes.md /// for the list of warnings and possibly add a new one</param> /// /// <param name="origin">Filename or member where the warning is coming from</param> /// <param name="subcategory">Optionally, further categorize this warning</param> /// <param name="version">Optional warning version number. Versioned warnings can be controlled with the /// warning wave option --warn VERSION. Unversioned warnings are unaffected by this option. </param> /// <returns>New MessageContainer of 'Warning' category</returns> internal static MessageContainer CreateWarningMessage (LinkContext context, string text, int code, MessageOrigin origin, WarnVersion version, string subcategory = MessageSubCategory.None) { if (!(code > 2000 && code <= 6000)) throw new ArgumentOutOfRangeException (nameof (code), $"The provided code '{code}' does not fall into the warning category, which is in the range of 2001 to 6000 (inclusive)."); return CreateWarningMessageContainer (context, text, code, origin, version, subcategory); } /// <summary> /// Create a warning message. /// </summary> /// <param name="context">Context with the relevant warning suppression info.</param> /// <param name="origin">Filename or member where the warning is coming from</param> /// <param name="id">Unique warning ID. Please see https://github.com/dotnet/linker/blob/main/docs/error-codes.md /// for the list of warnings and possibly add a new one</param> /// <param name="version">Optional warning version number. Versioned warnings can be controlled with the /// warning wave option --warn VERSION. Unversioned warnings are unaffected by this option. </param> /// <param name="args">Additional arguments to form a humanly readable message describing the warning</param> /// <returns>New MessageContainer of 'Warning' category</returns> internal static MessageContainer CreateWarningMessage (LinkContext context, MessageOrigin origin, DiagnosticId id, WarnVersion version, params string[] args) { if (!((int) id > 2000 && (int) id <= 6000)) throw new ArgumentOutOfRangeException (nameof (id), $"The provided code '{(int) id}' does not fall into the warning category, which is in the range of 2001 to 6000 (inclusive)."); return CreateWarningMessageContainer (context, origin, id, version, id.GetDiagnosticSubcategory (), args); } /// <summary> /// Create a custom warning message. /// </summary> /// <param name="context">Context with the relevant warning suppression info.</param> /// <param name="text">Humanly readable message describing the warning</param> /// <param name="code">A custom warning ID. This code should be greater than or equal to 6001 /// to avoid any collisions with existing and future linker warnings</param> /// <param name="origin">Filename or member where the warning is coming from</param> /// <param name="version">Optional warning version number. Versioned warnings can be controlled with the /// warning wave option --warn VERSION. Unversioned warnings are unaffected by this option</param> /// <param name="subcategory"></param> /// <returns>Custom MessageContainer of 'Warning' category</returns> public static MessageContainer CreateCustomWarningMessage (LinkContext context, string text, int code, MessageOrigin origin, WarnVersion version, string subcategory = MessageSubCategory.None) { #if DEBUG Debug.Assert (Assembly.GetCallingAssembly () != typeof (MessageContainer).Assembly, "'CreateCustomWarningMessage' is intended to be used by external assemblies only. Use 'CreateWarningMessage' instead."); #endif if (code <= 6000) throw new ArgumentOutOfRangeException (nameof (code), $"The provided code '{code}' does not fall into the permitted range for external warnings. To avoid possible collisions " + $"with existing and future {Constants.ILLink} warnings, external messages should use codes starting from 6001."); return CreateWarningMessageContainer (context, text, code, origin, version, subcategory); } private static MessageContainer CreateWarningMessageContainer (LinkContext context, string text, int code, MessageOrigin origin, WarnVersion version, string subcategory = MessageSubCategory.None) { if (!(version >= WarnVersion.ILLink0 && version <= WarnVersion.Latest)) throw new ArgumentException ($"The provided warning version '{version}' is invalid."); if (context.IsWarningSuppressed (code, origin)) return Empty; if (version > context.WarnVersion) return Empty; if (TryLogSingleWarning (context, code, origin, subcategory)) return Empty; if (context.IsWarningAsError (code)) return new MessageContainer (MessageCategory.WarningAsError, text, code, subcategory, origin); return new MessageContainer (MessageCategory.Warning, text, code, subcategory, origin); } private static MessageContainer CreateWarningMessageContainer (LinkContext context, MessageOrigin origin, DiagnosticId id, WarnVersion version, string subcategory, params string[] args) { if (!(version >= WarnVersion.ILLink0 && version <= WarnVersion.Latest)) throw new ArgumentException ($"The provided warning version '{version}' is invalid."); if (context.IsWarningSuppressed ((int) id, origin)) return Empty; if (version > context.WarnVersion) return Empty; if (TryLogSingleWarning (context, (int) id, origin, subcategory)) return Empty; if (context.IsWarningAsError ((int) id)) return new MessageContainer (MessageCategory.WarningAsError, id, subcategory, origin, args); return new MessageContainer (MessageCategory.Warning, id, subcategory, origin, args); } public bool IsWarningMessage ([NotNullWhen (true)] out int? code) { code = null; if (Category is MessageCategory.Warning or MessageCategory.WarningAsError) { // Warning messages always have a code. code = Code!; return true; } return false; } static bool TryLogSingleWarning (LinkContext context, int code, MessageOrigin origin, string subcategory) { if (subcategory != MessageSubCategory.TrimAnalysis) return false; // There are valid cases where we can't map the message to an assembly // For example if it's caused by something in an xml file passed on the command line // In that case, give up on single-warn collapse and just print out the warning on its own. var assembly = origin.Provider switch { AssemblyDefinition asm => asm, TypeDefinition type => type.Module.Assembly, IMemberDefinition member => member.DeclaringType.Module.Assembly, _ => null }; if (assembly == null) return false; // Any IL2026 warnings left in an assembly with an IsTrimmable attribute are considered intentional // and should not be collapsed, so that the user-visible RUC message gets printed. if (code == 2026 && context.IsTrimmable (assembly)) return false; var assemblyName = assembly.Name.Name; if (!context.IsSingleWarn (assemblyName)) return false; if (context.AssembliesWithGeneratedSingleWarning.Add (assemblyName)) context.LogWarning (context.GetAssemblyLocation (assembly), DiagnosticId.AssemblyProducedTrimWarnings, assemblyName); return true; } /// <summary> /// Create a info message. /// </summary> /// <param name="text">Humanly readable message</param> /// <returns>New MessageContainer of 'Info' category</returns> public static MessageContainer CreateInfoMessage (string text) { return new MessageContainer (MessageCategory.Info, text, null); } /// <summary> /// Create a diagnostics message. /// </summary> /// <param name="text">Humanly readable message</param> /// <returns>New MessageContainer of 'Diagnostic' category</returns> public static MessageContainer CreateDiagnosticMessage (string text) { return new MessageContainer (MessageCategory.Diagnostic, text, null); } private MessageContainer (MessageCategory category, string text, int? code, string subcategory = MessageSubCategory.None, MessageOrigin? origin = null) { Code = code; Category = category; Origin = origin; SubCategory = subcategory; Text = text; } private MessageContainer (MessageCategory category, DiagnosticId id, string subcategory = MessageSubCategory.None, MessageOrigin? origin = null, params string[] args) { Code = (int) id; Category = category; Origin = origin; SubCategory = subcategory; Text = new DiagnosticString (id).GetMessage (args); } public override string ToString () => ToMSBuildString (); public string ToMSBuildString () { const string originApp = Constants.ILLink; string origin = Origin?.ToString () ?? originApp; StringBuilder sb = new StringBuilder (); sb.Append (origin).Append (":"); if (!string.IsNullOrEmpty (SubCategory)) sb.Append (" ").Append (SubCategory); string cat; switch (Category) { case MessageCategory.Error: case MessageCategory.WarningAsError: cat = "error"; break; case MessageCategory.Warning: cat = "warning"; break; default: cat = ""; break; } if (!string.IsNullOrEmpty (cat)) { sb.Append (" ") .Append (cat) .Append (" IL") // Warning and error messages always have a code. .Append (Code!.Value.ToString ("D4")) .Append (": "); } else { sb.Append (" "); } if (Origin?.Provider != null) { if (Origin?.Provider is MethodDefinition method) sb.Append (method.GetDisplayName ()); else if (Origin?.Provider is MemberReference memberRef) sb.Append (memberRef.GetDisplayName ()); else if (Origin?.Provider is IMemberDefinition member) sb.Append (member.FullName); else if (Origin?.Provider is AssemblyDefinition assembly) sb.Append (assembly.Name.Name); else throw new NotSupportedException (); sb.Append (": "); } // Expected output $"{FileName(SourceLine, SourceColumn)}: {SubCategory}{Category} IL{Code}: ({MemberDisplayName}: ){Text}"); sb.Append (Text); return sb.ToString (); } public bool Equals (MessageContainer other) => (Category, Text, Code, SubCategory, Origin) == (other.Category, other.Text, other.Code, other.SubCategory, other.Origin); public override bool Equals (object? obj) => obj is MessageContainer messageContainer && Equals (messageContainer); public override int GetHashCode () => (Category, Text, Code, SubCategory, Origin).GetHashCode (); public int CompareTo (MessageContainer other) { if (Origin != null && other.Origin != null) { return Origin.Value.CompareTo (other.Origin.Value); } else if (Origin == null && other.Origin == null) { return (Code < other.Code) ? -1 : 1; } return (Origin == null) ? 1 : -1; } public static bool operator == (MessageContainer lhs, MessageContainer rhs) => lhs.Equals (rhs); public static bool operator != (MessageContainer lhs, MessageContainer rhs) => !lhs.Equals (rhs); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Reflection; using System.Text; using ILLink.Shared; using Mono.Cecil; namespace Mono.Linker { public readonly struct MessageContainer : IComparable<MessageContainer>, IEquatable<MessageContainer> { public static readonly MessageContainer Empty; /// <summary> /// Optional data with a filename, line and column that triggered the /// linker to output an error (or warning) message. /// </summary> public MessageOrigin? Origin { get; } public MessageCategory Category { get; } /// <summary> /// Further categorize the message. /// </summary> public string SubCategory { get; } /// <summary> /// Code identifier for errors and warnings reported by the IL linker. /// </summary> public int? Code { get; } /// <summary> /// User friendly text describing the error or warning. /// </summary> public string Text { get; } /// <summary> /// Create an error message. /// </summary> /// <param name="text">Humanly readable message describing the error</param> /// <param name="code">Unique error ID. Please see https://github.com/dotnet/linker/blob/main/docs/error-codes.md /// for the list of errors and possibly add a new one</param> /// <param name="subcategory">Optionally, further categorize this error</param> /// <param name="origin">Filename, line, and column where the error was found</param> /// <returns>New MessageContainer of 'Error' category</returns> internal static MessageContainer CreateErrorMessage (string text, int code, string subcategory = MessageSubCategory.None, MessageOrigin? origin = null) { if (!(code >= 1000 && code <= 2000)) throw new ArgumentOutOfRangeException (nameof (code), $"The provided code '{code}' does not fall into the error category, which is in the range of 1000 to 2000 (inclusive)."); return new MessageContainer (MessageCategory.Error, text, code, subcategory, origin); } /// <summary> /// Create an error message. /// </summary> /// <param name="origin">Filename, line, and column where the error was found</param> /// <param name="id">Unique error ID. Please see https://github.com/dotnet/linker/blob/main/docs/error-codes.md /// for the list of errors and possibly add a new one</param> /// <param name="args">Additional arguments to form a humanly readable message describing the warning</param> /// <returns>New MessageContainer of 'Error' category</returns> internal static MessageContainer CreateErrorMessage (MessageOrigin? origin, DiagnosticId id, params string[] args) { if (!((int) id >= 1000 && (int) id <= 2000)) throw new ArgumentOutOfRangeException (nameof (id), $"The provided code '{(int) id}' does not fall into the error category, which is in the range of 1000 to 2000 (inclusive)."); return new MessageContainer (MessageCategory.Error, id, origin: origin, args: args); } /// <summary> /// Create a custom error message. /// </summary> /// <param name="text">Humanly readable message describing the error</param> /// <param name="code">A custom error ID. This code should be greater than or equal to 6001 /// to avoid any collisions with existing and future linker errors</param> /// <param name="subcategory">Optionally, further categorize this error</param> /// <param name="origin">Filename or member where the error is coming from</param> /// <returns>Custom MessageContainer of 'Error' category</returns> public static MessageContainer CreateCustomErrorMessage (string text, int code, string subcategory = MessageSubCategory.None, MessageOrigin? origin = null) { #if DEBUG Debug.Assert (Assembly.GetCallingAssembly () != typeof (MessageContainer).Assembly, "'CreateCustomErrorMessage' is intended to be used by external assemblies only. Use 'CreateErrorMessage' instead."); #endif if (code <= 6000) throw new ArgumentOutOfRangeException (nameof (code), $"The provided code '{code}' does not fall into the permitted range for external errors. To avoid possible collisions " + "with existing and future {Constants.ILLink} errors, external messages should use codes starting from 6001."); return new MessageContainer (MessageCategory.Error, text, code, subcategory, origin); } /// <summary> /// Create a warning message. /// </summary> /// <param name="context">Context with the relevant warning suppression info.</param> /// <param name="text">Humanly readable message describing the warning</param> /// <param name="code">Unique warning ID. Please see https://github.com/dotnet/linker/blob/main/docs/error-codes.md /// for the list of warnings and possibly add a new one</param> /// /// <param name="origin">Filename or member where the warning is coming from</param> /// <param name="subcategory">Optionally, further categorize this warning</param> /// <param name="version">Optional warning version number. Versioned warnings can be controlled with the /// warning wave option --warn VERSION. Unversioned warnings are unaffected by this option. </param> /// <returns>New MessageContainer of 'Warning' category</returns> internal static MessageContainer CreateWarningMessage (LinkContext context, string text, int code, MessageOrigin origin, WarnVersion version, string subcategory = MessageSubCategory.None) { if (!(code > 2000 && code <= 6000)) throw new ArgumentOutOfRangeException (nameof (code), $"The provided code '{code}' does not fall into the warning category, which is in the range of 2001 to 6000 (inclusive)."); return CreateWarningMessageContainer (context, text, code, origin, version, subcategory); } /// <summary> /// Create a warning message. /// </summary> /// <param name="context">Context with the relevant warning suppression info.</param> /// <param name="origin">Filename or member where the warning is coming from</param> /// <param name="id">Unique warning ID. Please see https://github.com/dotnet/linker/blob/main/docs/error-codes.md /// for the list of warnings and possibly add a new one</param> /// <param name="version">Optional warning version number. Versioned warnings can be controlled with the /// warning wave option --warn VERSION. Unversioned warnings are unaffected by this option. </param> /// <param name="args">Additional arguments to form a humanly readable message describing the warning</param> /// <returns>New MessageContainer of 'Warning' category</returns> internal static MessageContainer CreateWarningMessage (LinkContext context, MessageOrigin origin, DiagnosticId id, WarnVersion version, params string[] args) { if (!((int) id > 2000 && (int) id <= 6000)) throw new ArgumentOutOfRangeException (nameof (id), $"The provided code '{(int) id}' does not fall into the warning category, which is in the range of 2001 to 6000 (inclusive)."); return CreateWarningMessageContainer (context, origin, id, version, id.GetDiagnosticSubcategory (), args); } /// <summary> /// Create a custom warning message. /// </summary> /// <param name="context">Context with the relevant warning suppression info.</param> /// <param name="text">Humanly readable message describing the warning</param> /// <param name="code">A custom warning ID. This code should be greater than or equal to 6001 /// to avoid any collisions with existing and future linker warnings</param> /// <param name="origin">Filename or member where the warning is coming from</param> /// <param name="version">Optional warning version number. Versioned warnings can be controlled with the /// warning wave option --warn VERSION. Unversioned warnings are unaffected by this option</param> /// <param name="subcategory"></param> /// <returns>Custom MessageContainer of 'Warning' category</returns> public static MessageContainer CreateCustomWarningMessage (LinkContext context, string text, int code, MessageOrigin origin, WarnVersion version, string subcategory = MessageSubCategory.None) { #if DEBUG Debug.Assert (Assembly.GetCallingAssembly () != typeof (MessageContainer).Assembly, "'CreateCustomWarningMessage' is intended to be used by external assemblies only. Use 'CreateWarningMessage' instead."); #endif if (code <= 6000) throw new ArgumentOutOfRangeException (nameof (code), $"The provided code '{code}' does not fall into the permitted range for external warnings. To avoid possible collisions " + $"with existing and future {Constants.ILLink} warnings, external messages should use codes starting from 6001."); return CreateWarningMessageContainer (context, text, code, origin, version, subcategory); } private static MessageContainer CreateWarningMessageContainer (LinkContext context, string text, int code, MessageOrigin origin, WarnVersion version, string subcategory = MessageSubCategory.None) { if (!(version >= WarnVersion.ILLink0 && version <= WarnVersion.Latest)) throw new ArgumentException ($"The provided warning version '{version}' is invalid."); if (context.IsWarningSuppressed (code, origin)) return Empty; if (version > context.WarnVersion) return Empty; if (TryLogSingleWarning (context, code, origin, subcategory)) return Empty; if (context.IsWarningAsError (code)) return new MessageContainer (MessageCategory.WarningAsError, text, code, subcategory, origin); return new MessageContainer (MessageCategory.Warning, text, code, subcategory, origin); } private static MessageContainer CreateWarningMessageContainer (LinkContext context, MessageOrigin origin, DiagnosticId id, WarnVersion version, string subcategory, params string[] args) { if (!(version >= WarnVersion.ILLink0 && version <= WarnVersion.Latest)) throw new ArgumentException ($"The provided warning version '{version}' is invalid."); if (context.IsWarningSuppressed ((int) id, origin)) return Empty; if (version > context.WarnVersion) return Empty; if (TryLogSingleWarning (context, (int) id, origin, subcategory)) return Empty; if (context.IsWarningAsError ((int) id)) return new MessageContainer (MessageCategory.WarningAsError, id, subcategory, origin, args); return new MessageContainer (MessageCategory.Warning, id, subcategory, origin, args); } public bool IsWarningMessage ([NotNullWhen (true)] out int? code) { code = null; if (Category is MessageCategory.Warning or MessageCategory.WarningAsError) { // Warning messages always have a code. code = Code!; return true; } return false; } static bool TryLogSingleWarning (LinkContext context, int code, MessageOrigin origin, string subcategory) { if (subcategory != MessageSubCategory.TrimAnalysis) return false; // There are valid cases where we can't map the message to an assembly // For example if it's caused by something in an xml file passed on the command line // In that case, give up on single-warn collapse and just print out the warning on its own. var assembly = origin.Provider switch { AssemblyDefinition asm => asm, TypeDefinition type => type.Module.Assembly, IMemberDefinition member => member.DeclaringType.Module.Assembly, _ => null }; if (assembly == null) return false; // Any IL2026 warnings left in an assembly with an IsTrimmable attribute are considered intentional // and should not be collapsed, so that the user-visible RUC message gets printed. if (code == 2026 && context.IsTrimmable (assembly)) return false; var assemblyName = assembly.Name.Name; if (!context.IsSingleWarn (assemblyName)) return false; if (context.AssembliesWithGeneratedSingleWarning.Add (assemblyName)) context.LogWarning (context.GetAssemblyLocation (assembly), DiagnosticId.AssemblyProducedTrimWarnings, assemblyName); return true; } /// <summary> /// Create a info message. /// </summary> /// <param name="text">Humanly readable message</param> /// <returns>New MessageContainer of 'Info' category</returns> public static MessageContainer CreateInfoMessage (string text) { return new MessageContainer (MessageCategory.Info, text, null); } /// <summary> /// Create a diagnostics message. /// </summary> /// <param name="text">Humanly readable message</param> /// <returns>New MessageContainer of 'Diagnostic' category</returns> public static MessageContainer CreateDiagnosticMessage (string text) { return new MessageContainer (MessageCategory.Diagnostic, text, null); } private MessageContainer (MessageCategory category, string text, int? code, string subcategory = MessageSubCategory.None, MessageOrigin? origin = null) { Code = code; Category = category; Origin = origin; SubCategory = subcategory; Text = text; } private MessageContainer (MessageCategory category, DiagnosticId id, string subcategory = MessageSubCategory.None, MessageOrigin? origin = null, params string[] args) { Code = (int) id; Category = category; Origin = origin; SubCategory = subcategory; Text = new DiagnosticString (id).GetMessage (args); } public override string ToString () => ToMSBuildString (); public string ToMSBuildString () { const string originApp = Constants.ILLink; string origin = Origin?.ToString () ?? originApp; StringBuilder sb = new StringBuilder (); sb.Append (origin).Append (":"); if (!string.IsNullOrEmpty (SubCategory)) sb.Append (" ").Append (SubCategory); string cat; switch (Category) { case MessageCategory.Error: case MessageCategory.WarningAsError: cat = "error"; break; case MessageCategory.Warning: cat = "warning"; break; default: cat = ""; break; } if (!string.IsNullOrEmpty (cat)) { sb.Append (" ") .Append (cat) .Append (" IL") // Warning and error messages always have a code. .Append (Code!.Value.ToString ("D4")) .Append (": "); } else { sb.Append (" "); } if (Origin?.Provider != null) { if (Origin?.Provider is MethodDefinition method) sb.Append (method.GetDisplayName ()); else if (Origin?.Provider is MemberReference memberRef) sb.Append (memberRef.GetDisplayName ()); else if (Origin?.Provider is IMemberDefinition member) sb.Append (member.FullName); else if (Origin?.Provider is AssemblyDefinition assembly) sb.Append (assembly.Name.Name); else throw new NotSupportedException (); sb.Append (": "); } // Expected output $"{FileName(SourceLine, SourceColumn)}: {SubCategory}{Category} IL{Code}: ({MemberDisplayName}: ){Text}"); sb.Append (Text); return sb.ToString (); } public bool Equals (MessageContainer other) => (Category, Text, Code, SubCategory, Origin) == (other.Category, other.Text, other.Code, other.SubCategory, other.Origin); public override bool Equals (object? obj) => obj is MessageContainer messageContainer && Equals (messageContainer); public override int GetHashCode () => (Category, Text, Code, SubCategory, Origin).GetHashCode (); public int CompareTo (MessageContainer other) { if (Origin != null && other.Origin != null) { return Origin.Value.CompareTo (other.Origin.Value); } else if (Origin == null && other.Origin == null) { return (Code < other.Code) ? -1 : 1; } return (Origin == null) ? 1 : -1; } public static bool operator == (MessageContainer lhs, MessageContainer rhs) => lhs.Equals (rhs); public static bool operator != (MessageContainer lhs, MessageContainer rhs) => !lhs.Equals (rhs); } }
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/LocalVariables.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; namespace System.Linq.Expressions.Interpreter { internal sealed class LocalVariable { private const int IsBoxedFlag = 1; private const int InClosureFlag = 2; public readonly int Index; private int _flags; public bool IsBoxed { get { return (_flags & IsBoxedFlag) != 0; } set { if (value) { _flags |= IsBoxedFlag; } else { _flags &= ~IsBoxedFlag; } } } public bool InClosure => (_flags & InClosureFlag) != 0; internal LocalVariable(int index, bool closure) { Index = index; _flags = (closure ? InClosureFlag : 0); } public override string ToString() => string.Create(CultureInfo.InvariantCulture, $"{Index}: {(IsBoxed ? "boxed" : null)} {(InClosure ? "in closure" : null)}"); } internal readonly struct LocalDefinition : IEquatable<LocalDefinition> { internal LocalDefinition(int localIndex, ParameterExpression parameter) { Index = localIndex; Parameter = parameter; } public int Index { get; } public ParameterExpression Parameter { get; } public override bool Equals([NotNullWhen(true)] object? obj) => obj is LocalDefinition other && Equals(other); public bool Equals(LocalDefinition other) => other.Index == Index && other.Parameter == Parameter; public override int GetHashCode() => Parameter is null ? 0 : Parameter.GetHashCode() ^ Index.GetHashCode(); } internal sealed class LocalVariables { private readonly HybridReferenceDictionary<ParameterExpression, VariableScope> _variables = new HybridReferenceDictionary<ParameterExpression, VariableScope>(); private Dictionary<ParameterExpression, LocalVariable>? _closureVariables; private int _localCount, _maxLocalCount; public LocalDefinition DefineLocal(ParameterExpression variable, int start) { var result = new LocalVariable(_localCount++, closure: false); _maxLocalCount = Math.Max(_localCount, _maxLocalCount); VariableScope? existing, newScope; if (_variables.TryGetValue(variable, out existing)) { newScope = new VariableScope(result, start, existing); if (existing.ChildScopes == null) { existing.ChildScopes = new List<VariableScope>(); } existing.ChildScopes.Add(newScope); } else { newScope = new VariableScope(result, start, parent: null); } _variables[variable] = newScope; return new LocalDefinition(result.Index, variable); } public void UndefineLocal(LocalDefinition definition, int end) { VariableScope scope = _variables[definition.Parameter]; scope.Stop = end; if (scope.Parent != null) { _variables[definition.Parameter] = scope.Parent; } else { _variables.Remove(definition.Parameter); } _localCount--; } internal void Box(ParameterExpression variable, InstructionList instructions) { VariableScope scope = _variables[variable]; LocalVariable local = scope.Variable; Debug.Assert(!local.IsBoxed && !local.InClosure); _variables[variable].Variable.IsBoxed = true; int curChild = 0; for (int i = scope.Start; i < scope.Stop && i < instructions.Count; i++) { if (scope.ChildScopes != null && scope.ChildScopes[curChild].Start == i) { // skip boxing in the child scope VariableScope child = scope.ChildScopes[curChild]; i = child.Stop; curChild++; continue; } instructions.SwitchToBoxed(local.Index, i); } } public int LocalCount => _maxLocalCount; public bool TryGetLocalOrClosure(ParameterExpression var, [NotNullWhen(true)] out LocalVariable? local) { if (_variables.TryGetValue(var, out VariableScope? scope)) { local = scope.Variable; return true; } if (_closureVariables != null && _closureVariables.TryGetValue(var, out local)) { return true; } local = null; return false; } /// <summary> /// Gets the variables which are defined in an outer scope and available within the current scope. /// </summary> internal Dictionary<ParameterExpression, LocalVariable>? ClosureVariables => _closureVariables; internal LocalVariable AddClosureVariable(ParameterExpression variable) { if (_closureVariables == null) { _closureVariables = new Dictionary<ParameterExpression, LocalVariable>(); } LocalVariable result = new LocalVariable(_closureVariables.Count, true); _closureVariables.Add(variable, result); return result; } /// <summary> /// Tracks where a variable is defined and what range of instructions it's used in. /// </summary> private sealed class VariableScope { public readonly int Start; public int Stop = int.MaxValue; public readonly LocalVariable Variable; public readonly VariableScope? Parent; public List<VariableScope>? ChildScopes; public VariableScope(LocalVariable variable, int start, VariableScope? parent) { Variable = variable; Start = start; Parent = parent; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; namespace System.Linq.Expressions.Interpreter { internal sealed class LocalVariable { private const int IsBoxedFlag = 1; private const int InClosureFlag = 2; public readonly int Index; private int _flags; public bool IsBoxed { get { return (_flags & IsBoxedFlag) != 0; } set { if (value) { _flags |= IsBoxedFlag; } else { _flags &= ~IsBoxedFlag; } } } public bool InClosure => (_flags & InClosureFlag) != 0; internal LocalVariable(int index, bool closure) { Index = index; _flags = (closure ? InClosureFlag : 0); } public override string ToString() => string.Create(CultureInfo.InvariantCulture, $"{Index}: {(IsBoxed ? "boxed" : null)} {(InClosure ? "in closure" : null)}"); } internal readonly struct LocalDefinition : IEquatable<LocalDefinition> { internal LocalDefinition(int localIndex, ParameterExpression parameter) { Index = localIndex; Parameter = parameter; } public int Index { get; } public ParameterExpression Parameter { get; } public override bool Equals([NotNullWhen(true)] object? obj) => obj is LocalDefinition other && Equals(other); public bool Equals(LocalDefinition other) => other.Index == Index && other.Parameter == Parameter; public override int GetHashCode() => Parameter is null ? 0 : Parameter.GetHashCode() ^ Index.GetHashCode(); } internal sealed class LocalVariables { private readonly HybridReferenceDictionary<ParameterExpression, VariableScope> _variables = new HybridReferenceDictionary<ParameterExpression, VariableScope>(); private Dictionary<ParameterExpression, LocalVariable>? _closureVariables; private int _localCount, _maxLocalCount; public LocalDefinition DefineLocal(ParameterExpression variable, int start) { var result = new LocalVariable(_localCount++, closure: false); _maxLocalCount = Math.Max(_localCount, _maxLocalCount); VariableScope? existing, newScope; if (_variables.TryGetValue(variable, out existing)) { newScope = new VariableScope(result, start, existing); if (existing.ChildScopes == null) { existing.ChildScopes = new List<VariableScope>(); } existing.ChildScopes.Add(newScope); } else { newScope = new VariableScope(result, start, parent: null); } _variables[variable] = newScope; return new LocalDefinition(result.Index, variable); } public void UndefineLocal(LocalDefinition definition, int end) { VariableScope scope = _variables[definition.Parameter]; scope.Stop = end; if (scope.Parent != null) { _variables[definition.Parameter] = scope.Parent; } else { _variables.Remove(definition.Parameter); } _localCount--; } internal void Box(ParameterExpression variable, InstructionList instructions) { VariableScope scope = _variables[variable]; LocalVariable local = scope.Variable; Debug.Assert(!local.IsBoxed && !local.InClosure); _variables[variable].Variable.IsBoxed = true; int curChild = 0; for (int i = scope.Start; i < scope.Stop && i < instructions.Count; i++) { if (scope.ChildScopes != null && scope.ChildScopes[curChild].Start == i) { // skip boxing in the child scope VariableScope child = scope.ChildScopes[curChild]; i = child.Stop; curChild++; continue; } instructions.SwitchToBoxed(local.Index, i); } } public int LocalCount => _maxLocalCount; public bool TryGetLocalOrClosure(ParameterExpression var, [NotNullWhen(true)] out LocalVariable? local) { if (_variables.TryGetValue(var, out VariableScope? scope)) { local = scope.Variable; return true; } if (_closureVariables != null && _closureVariables.TryGetValue(var, out local)) { return true; } local = null; return false; } /// <summary> /// Gets the variables which are defined in an outer scope and available within the current scope. /// </summary> internal Dictionary<ParameterExpression, LocalVariable>? ClosureVariables => _closureVariables; internal LocalVariable AddClosureVariable(ParameterExpression variable) { if (_closureVariables == null) { _closureVariables = new Dictionary<ParameterExpression, LocalVariable>(); } LocalVariable result = new LocalVariable(_closureVariables.Count, true); _closureVariables.Add(variable, result); return result; } /// <summary> /// Tracks where a variable is defined and what range of instructions it's used in. /// </summary> private sealed class VariableScope { public readonly int Start; public int Stop = int.MaxValue; public readonly LocalVariable Variable; public readonly VariableScope? Parent; public List<VariableScope>? ChildScopes; public VariableScope(LocalVariable variable, int start, VariableScope? parent) { Variable = variable; Start = start; Parent = parent; } } } }
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/libraries/System.Diagnostics.EventLog/tests/System/Diagnostics/Reader/EventLogSessionTests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.Eventing.Reader; using System.Globalization; using System.IO; using System.Security; using Xunit; namespace System.Diagnostics.Tests { public class EventLogSessionTests : FileCleanupTestBase { private const string LogName = "Application"; [ConditionalTheory(typeof(Helpers), nameof(Helpers.SupportsEventLogs))] [InlineData(true)] [InlineData(false)] public void Ctors_ProviderNames_LogNames_NotEmpty(bool usingDefaultCtor) { using (var session = usingDefaultCtor ? new EventLogSession() : new EventLogSession(null)) { Assert.NotEmpty(session.GetProviderNames()); Assert.NotEmpty(session.GetLogNames()); } } [ConditionalTheory(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))] [InlineData(true)] [InlineData(false)] public void ExportLogAndMessages_NullPath_Throws(bool usingDefaultCtor) { using (var session = usingDefaultCtor ? new EventLogSession() : new EventLogSession(null)) { Assert.Throws<ArgumentNullException>(() => session.ExportLogAndMessages(null, PathType.LogName, LogName, GetTestFilePath())); // Does not throw: session.ExportLogAndMessages(LogName, PathType.LogName, LogName, GetTestFilePath()); session.ExportLogAndMessages(LogName, PathType.LogName, LogName, GetTestFilePath(), false, targetCultureInfo: CultureInfo.CurrentCulture); session.CancelCurrentOperations(); } } [ConditionalTheory(typeof(Helpers), nameof(Helpers.SupportsEventLogs))] [InlineData(true)] [InlineData(false)] public void ExportLog_InvalidInputCombinations_Throws(bool usingDefaultCtor) { using (var session = usingDefaultCtor ? new EventLogSession() : new EventLogSession(null)) { Assert.Throws<ArgumentNullException>(() => session.ExportLog(null, PathType.LogName, LogName, GetTestFilePath())); Assert.Throws<ArgumentNullException>(() => session.ExportLog(LogName, PathType.LogName, LogName, null)); Assert.Throws<ArgumentOutOfRangeException>(() => session.ExportLog(LogName, (PathType)0, LogName, GetTestFilePath())); Assert.Throws<EventLogNotFoundException>(() => session.ExportLog(LogName, PathType.FilePath, LogName, GetTestFilePath())); // Does not throw: session.ExportLog(LogName, PathType.LogName, LogName, GetTestFilePath(), tolerateQueryErrors: true); session.CancelCurrentOperations(); } } [ConditionalFact(typeof(Helpers), nameof(Helpers.SupportsEventLogs))] public void GetProviderNames_WithPassword_Throws() { var password = new SecureString(); password.AppendChar('a'); using (var session = new EventLogSession(null, null, null, password, SessionAuthentication.Default)) { Assert.Throws<UnauthorizedAccessException>(() => session.GetProviderNames()); } } [ConditionalFact(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))] public void ClearLog_LogNameNullEmptyOrNotExist_Throws() { using (var session = new EventLogSession()) { Assert.Throws<ArgumentNullException>(() => session.ClearLog(null)); Assert.Throws<ArgumentNullException>(() => session.ClearLog(null, backupPath: GetTestFilePath())); Assert.Throws<EventLogException>(() => session.ClearLog("")); Assert.Throws<EventLogNotFoundException>(() => session.ClearLog(logName: nameof(ClearLog_LogNameNullEmptyOrNotExist_Throws))); } } [ConditionalFact(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))] public void ClearLog_LogExists_Success() { using (var session = new EventLogSession()) { string log = "Log_" + nameof(ClearLog_LogExists_Success); string source = "Source_" + nameof(ClearLog_LogExists_Success); try { EventLog.CreateEventSource(source, log); using (EventLog eventLog = new EventLog()) { eventLog.Source = source; Helpers.Retry(() => eventLog.WriteEntry("Writing to event log.")); Assert.NotEqual(0, Helpers.Retry((() => eventLog.Entries.Count))); session.ClearLog(logName: log); Assert.Equal(0, Helpers.Retry((() => eventLog.Entries.Count))); } } finally { EventLog.DeleteEventSource(source); } session.CancelCurrentOperations(); } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.Eventing.Reader; using System.Globalization; using System.IO; using System.Security; using Xunit; namespace System.Diagnostics.Tests { public class EventLogSessionTests : FileCleanupTestBase { private const string LogName = "Application"; [ConditionalTheory(typeof(Helpers), nameof(Helpers.SupportsEventLogs))] [InlineData(true)] [InlineData(false)] public void Ctors_ProviderNames_LogNames_NotEmpty(bool usingDefaultCtor) { using (var session = usingDefaultCtor ? new EventLogSession() : new EventLogSession(null)) { Assert.NotEmpty(session.GetProviderNames()); Assert.NotEmpty(session.GetLogNames()); } } [ConditionalTheory(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))] [InlineData(true)] [InlineData(false)] public void ExportLogAndMessages_NullPath_Throws(bool usingDefaultCtor) { using (var session = usingDefaultCtor ? new EventLogSession() : new EventLogSession(null)) { Assert.Throws<ArgumentNullException>(() => session.ExportLogAndMessages(null, PathType.LogName, LogName, GetTestFilePath())); // Does not throw: session.ExportLogAndMessages(LogName, PathType.LogName, LogName, GetTestFilePath()); session.ExportLogAndMessages(LogName, PathType.LogName, LogName, GetTestFilePath(), false, targetCultureInfo: CultureInfo.CurrentCulture); session.CancelCurrentOperations(); } } [ConditionalTheory(typeof(Helpers), nameof(Helpers.SupportsEventLogs))] [InlineData(true)] [InlineData(false)] public void ExportLog_InvalidInputCombinations_Throws(bool usingDefaultCtor) { using (var session = usingDefaultCtor ? new EventLogSession() : new EventLogSession(null)) { Assert.Throws<ArgumentNullException>(() => session.ExportLog(null, PathType.LogName, LogName, GetTestFilePath())); Assert.Throws<ArgumentNullException>(() => session.ExportLog(LogName, PathType.LogName, LogName, null)); Assert.Throws<ArgumentOutOfRangeException>(() => session.ExportLog(LogName, (PathType)0, LogName, GetTestFilePath())); Assert.Throws<EventLogNotFoundException>(() => session.ExportLog(LogName, PathType.FilePath, LogName, GetTestFilePath())); // Does not throw: session.ExportLog(LogName, PathType.LogName, LogName, GetTestFilePath(), tolerateQueryErrors: true); session.CancelCurrentOperations(); } } [ConditionalFact(typeof(Helpers), nameof(Helpers.SupportsEventLogs))] public void GetProviderNames_WithPassword_Throws() { var password = new SecureString(); password.AppendChar('a'); using (var session = new EventLogSession(null, null, null, password, SessionAuthentication.Default)) { Assert.Throws<UnauthorizedAccessException>(() => session.GetProviderNames()); } } [ConditionalFact(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))] public void ClearLog_LogNameNullEmptyOrNotExist_Throws() { using (var session = new EventLogSession()) { Assert.Throws<ArgumentNullException>(() => session.ClearLog(null)); Assert.Throws<ArgumentNullException>(() => session.ClearLog(null, backupPath: GetTestFilePath())); Assert.Throws<EventLogException>(() => session.ClearLog("")); Assert.Throws<EventLogNotFoundException>(() => session.ClearLog(logName: nameof(ClearLog_LogNameNullEmptyOrNotExist_Throws))); } } [ConditionalFact(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))] public void ClearLog_LogExists_Success() { using (var session = new EventLogSession()) { string log = "Log_" + nameof(ClearLog_LogExists_Success); string source = "Source_" + nameof(ClearLog_LogExists_Success); try { EventLog.CreateEventSource(source, log); using (EventLog eventLog = new EventLog()) { eventLog.Source = source; Helpers.Retry(() => eventLog.WriteEntry("Writing to event log.")); Assert.NotEqual(0, Helpers.Retry((() => eventLog.Entries.Count))); session.ClearLog(logName: log); Assert.Equal(0, Helpers.Retry((() => eventLog.Entries.Count))); } } finally { EventLog.DeleteEventSource(source); } session.CancelCurrentOperations(); } } } }
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/libraries/System.Private.Xml/src/System/Xml/Schema/XmlSchema.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.Xml.Schema { using System.IO; using System.Collections; using System.ComponentModel; using System.Xml.Serialization; using System.Threading; using System.Diagnostics; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; [XmlRoot("schema", Namespace = XmlSchema.Namespace)] public class XmlSchema : XmlSchemaObject { public const string Namespace = XmlReservedNs.NsXs; public const string InstanceNamespace = XmlReservedNs.NsXsi; private XmlSchemaForm _attributeFormDefault = XmlSchemaForm.None; private XmlSchemaForm _elementFormDefault = XmlSchemaForm.None; private XmlSchemaDerivationMethod _blockDefault = XmlSchemaDerivationMethod.None; private XmlSchemaDerivationMethod _finalDefault = XmlSchemaDerivationMethod.None; private string? _targetNs; private string? _version; private XmlSchemaObjectCollection _includes = new XmlSchemaObjectCollection(); private XmlSchemaObjectCollection _items = new XmlSchemaObjectCollection(); private string? _id; private XmlAttribute[]? _moreAttributes; // compiled info private bool _isCompiled; private bool _isCompiledBySet; private bool _isPreprocessed; private bool _isRedefined; private int _errorCount; private XmlSchemaObjectTable? _attributes; private XmlSchemaObjectTable _attributeGroups = new XmlSchemaObjectTable(); private XmlSchemaObjectTable _elements = new XmlSchemaObjectTable(); private XmlSchemaObjectTable _types = new XmlSchemaObjectTable(); private readonly XmlSchemaObjectTable _groups = new XmlSchemaObjectTable(); private readonly XmlSchemaObjectTable _notations = new XmlSchemaObjectTable(); private readonly XmlSchemaObjectTable _identityConstraints = new XmlSchemaObjectTable(); private static int s_globalIdCounter = -1; private ArrayList? _importedSchemas; private ArrayList? _importedNamespaces; private int _schemaId = -1; //Not added to a set private Uri? _baseUri; private bool _isChameleon; private readonly Hashtable _ids = new Hashtable(); private XmlDocument? _document; private XmlNameTable? _nameTable; public XmlSchema() { } public static XmlSchema? Read(TextReader reader, ValidationEventHandler? validationEventHandler) { return Read(new XmlTextReader(reader), validationEventHandler); } public static XmlSchema? Read(Stream stream, ValidationEventHandler? validationEventHandler) { return Read(new XmlTextReader(stream), validationEventHandler); } public static XmlSchema? Read(XmlReader reader, ValidationEventHandler? validationEventHandler) { XmlNameTable nameTable = reader.NameTable; Parser parser = new Parser(SchemaType.XSD, nameTable, new SchemaNames(nameTable), validationEventHandler); try { parser.Parse(reader, null); } catch (XmlSchemaException e) { if (validationEventHandler != null) { validationEventHandler(null, new ValidationEventArgs(e)); } else { throw; } return null; } return parser.XmlSchema; } [RequiresUnreferencedCode(XmlSerializer.TrimSerializationWarning)] public void Write(Stream stream) { Write(stream, null); } [RequiresUnreferencedCode(XmlSerializer.TrimSerializationWarning)] public void Write(Stream stream, XmlNamespaceManager? namespaceManager) { XmlTextWriter xmlWriter = new XmlTextWriter(stream, null); xmlWriter.Formatting = Formatting.Indented; Write(xmlWriter, namespaceManager); } [RequiresUnreferencedCode(XmlSerializer.TrimSerializationWarning)] public void Write(TextWriter writer) { Write(writer, null); } [RequiresUnreferencedCode(XmlSerializer.TrimSerializationWarning)] public void Write(TextWriter writer, XmlNamespaceManager? namespaceManager) { XmlTextWriter xmlWriter = new XmlTextWriter(writer); xmlWriter.Formatting = Formatting.Indented; Write(xmlWriter, namespaceManager); } [RequiresUnreferencedCode(XmlSerializer.TrimSerializationWarning)] public void Write(XmlWriter writer) { Write(writer, null); } [DynamicDependency(TrimmerConstants.PublicMembers, typeof(XmlSchema))] // This method may be safe given the above Dynamic Dependency but it is not yet fully understood if just preserving // all of XmlSchema public members is enough in order to be safe in all cases, so we have opted to keep the RequiresUnreferencedCode // attribute for now. This can be removed in the future if it is determined that the above is enough for all scenarios to be trim-safe. [RequiresUnreferencedCode(XmlSerializer.TrimSerializationWarning)] public void Write(XmlWriter writer, XmlNamespaceManager? namespaceManager) { XmlSerializer serializer = new XmlSerializer(typeof(XmlSchema)); XmlSerializerNamespaces ns; if (namespaceManager != null) { ns = new XmlSerializerNamespaces(); bool ignoreXS = false; if (this.Namespaces != null) { //User may have set both nsManager and Namespaces property on the XmlSchema object ignoreXS = this.Namespaces.TryLookupPrefix("xs", out _) || this.Namespaces.TryLookupNamespace(XmlReservedNs.NsXs, out _); } if (!ignoreXS && namespaceManager.LookupPrefix(XmlReservedNs.NsXs) == null && namespaceManager.LookupNamespace("xs") == null) { ns.Add("xs", XmlReservedNs.NsXs); } foreach (string prefix in namespaceManager) { if (prefix != "xml" && prefix != "xmlns") { ns.Add(prefix, namespaceManager.LookupNamespace(prefix!)); } } } else if (this.Namespaces != null && this.Namespaces.Count > 0) { if (!this.Namespaces.TryLookupPrefix("xs", out _) && !this.Namespaces.TryLookupNamespace(XmlReservedNs.NsXs, out _)) { //Prefix xs not defined AND schema namespace not already mapped to a prefix this.Namespaces.Add("xs", XmlReservedNs.NsXs); } ns = this.Namespaces; } else { ns = new XmlSerializerNamespaces(); ns.Add("xs", XmlSchema.Namespace); if (_targetNs != null && _targetNs.Length != 0) { ns.Add("tns", _targetNs); } } serializer.Serialize(writer, this, ns); } [Obsolete("XmlSchema.Compile has been deprecated. Use System.Xml.Schema.XmlSchemaSet for schema compilation and validation.")] public void Compile(ValidationEventHandler? validationEventHandler) { SchemaInfo sInfo = new SchemaInfo(); sInfo.SchemaType = SchemaType.XSD; CompileSchema(null, null, sInfo, null, validationEventHandler, NameTable, false); } [Obsolete("XmlSchema.Compile has been deprecated. Use System.Xml.Schema.XmlSchemaSet for schema compilation and validation.")] public void Compile(ValidationEventHandler? validationEventHandler, XmlResolver? resolver) { SchemaInfo sInfo = new SchemaInfo(); sInfo.SchemaType = SchemaType.XSD; CompileSchema(null, resolver, sInfo, null, validationEventHandler, NameTable, false); } #pragma warning disable 618 internal bool CompileSchema(XmlSchemaCollection? xsc, XmlResolver? resolver, SchemaInfo schemaInfo, string? ns, ValidationEventHandler? validationEventHandler, XmlNameTable nameTable, bool CompileContentModel) { //Need to lock here to prevent multi-threading problems when same schema is added to set and compiled lock (this) { //Preprocessing SchemaCollectionPreprocessor prep = new SchemaCollectionPreprocessor(nameTable, null, validationEventHandler); prep.XmlResolver = resolver; if (!prep.Execute(this, ns, true, xsc)) { return false; } //Compilation SchemaCollectionCompiler compiler = new SchemaCollectionCompiler(nameTable, validationEventHandler); _isCompiled = compiler.Execute(this, schemaInfo, CompileContentModel); this.SetIsCompiled(_isCompiled); return _isCompiled; } } #pragma warning restore 618 internal void CompileSchemaInSet(XmlNameTable nameTable, ValidationEventHandler? eventHandler, XmlSchemaCompilationSettings? compilationSettings) { Debug.Assert(_isPreprocessed); Compiler setCompiler = new Compiler(nameTable, eventHandler, null, compilationSettings); setCompiler.Prepare(this, true); _isCompiledBySet = setCompiler.Compile(); } [XmlAttribute("attributeFormDefault"), DefaultValue(XmlSchemaForm.None)] public XmlSchemaForm AttributeFormDefault { get { return _attributeFormDefault; } set { _attributeFormDefault = value; } } [XmlAttribute("blockDefault"), DefaultValue(XmlSchemaDerivationMethod.None)] public XmlSchemaDerivationMethod BlockDefault { get { return _blockDefault; } set { _blockDefault = value; } } [XmlAttribute("finalDefault"), DefaultValue(XmlSchemaDerivationMethod.None)] public XmlSchemaDerivationMethod FinalDefault { get { return _finalDefault; } set { _finalDefault = value; } } [XmlAttribute("elementFormDefault"), DefaultValue(XmlSchemaForm.None)] public XmlSchemaForm ElementFormDefault { get { return _elementFormDefault; } set { _elementFormDefault = value; } } [XmlAttribute("targetNamespace", DataType = "anyURI")] public string? TargetNamespace { get { return _targetNs; } set { _targetNs = value; } } [XmlAttribute("version", DataType = "token")] public string? Version { get { return _version; } set { _version = value; } } [XmlElement("include", typeof(XmlSchemaInclude)), XmlElement("import", typeof(XmlSchemaImport)), XmlElement("redefine", typeof(XmlSchemaRedefine))] public XmlSchemaObjectCollection Includes { get { return _includes; } } [XmlElement("annotation", typeof(XmlSchemaAnnotation)), XmlElement("attribute", typeof(XmlSchemaAttribute)), XmlElement("attributeGroup", typeof(XmlSchemaAttributeGroup)), XmlElement("complexType", typeof(XmlSchemaComplexType)), XmlElement("simpleType", typeof(XmlSchemaSimpleType)), XmlElement("element", typeof(XmlSchemaElement)), XmlElement("group", typeof(XmlSchemaGroup)), XmlElement("notation", typeof(XmlSchemaNotation))] public XmlSchemaObjectCollection Items { get { return _items; } } // Compiled info [XmlIgnore] public bool IsCompiled { get { return _isCompiled || _isCompiledBySet; } } [XmlIgnore] internal bool IsCompiledBySet { get { return _isCompiledBySet; } set { _isCompiledBySet = value; } } [XmlIgnore] internal bool IsPreprocessed { get { return _isPreprocessed; } set { _isPreprocessed = value; } } [XmlIgnore] internal bool IsRedefined { get { return _isRedefined; } set { _isRedefined = value; } } [XmlIgnore] public XmlSchemaObjectTable Attributes { get { if (_attributes == null) { _attributes = new XmlSchemaObjectTable(); } return _attributes; } } [XmlIgnore] public XmlSchemaObjectTable AttributeGroups { get { if (_attributeGroups == null) { _attributeGroups = new XmlSchemaObjectTable(); } return _attributeGroups; } } [XmlIgnore] public XmlSchemaObjectTable SchemaTypes { get { if (_types == null) { _types = new XmlSchemaObjectTable(); } return _types; } } [XmlIgnore] public XmlSchemaObjectTable Elements { get { if (_elements == null) { _elements = new XmlSchemaObjectTable(); } return _elements; } } [XmlAttribute("id", DataType = "ID")] public string? Id { get { return _id; } set { _id = value; } } [XmlAnyAttribute] public XmlAttribute[]? UnhandledAttributes { get { return _moreAttributes; } set { _moreAttributes = value; } } [XmlIgnore] public XmlSchemaObjectTable Groups { get { return _groups; } } [XmlIgnore] public XmlSchemaObjectTable Notations { get { return _notations; } } [XmlIgnore] internal XmlSchemaObjectTable IdentityConstraints { get { return _identityConstraints; } } [XmlIgnore] internal Uri? BaseUri { get { return _baseUri; } set { _baseUri = value; } } [XmlIgnore] // Please be careful with this property. Since it lazy initialized and its value depends on a global state // if it gets called on multiple schemas in a different order the schemas will end up with different IDs // Unfortunately the IDs are used to sort the schemas in the schema set and thus changing the IDs might change // the order which would be a breaking change!! // Simply put if you are planning to add or remove a call to this getter you need to be extra carefull // or better don't do it at all. internal int SchemaId { get { if (_schemaId == -1) { _schemaId = Interlocked.Increment(ref s_globalIdCounter); } return _schemaId; } } [XmlIgnore] internal bool IsChameleon { get { return _isChameleon; } set { _isChameleon = value; } } [XmlIgnore] internal Hashtable Ids { get { return _ids; } } [XmlIgnore] internal XmlDocument Document { get { if (_document == null) _document = new XmlDocument(); return _document; } } [XmlIgnore] internal int ErrorCount { get { return _errorCount; } set { _errorCount = value; } } internal new XmlSchema Clone() { XmlSchema that = new XmlSchema(); that._attributeFormDefault = _attributeFormDefault; that._elementFormDefault = _elementFormDefault; that._blockDefault = _blockDefault; that._finalDefault = _finalDefault; that._targetNs = _targetNs; that._version = _version; that._includes = _includes; that.Namespaces = this.Namespaces; that._items = _items; that.BaseUri = this.BaseUri; SchemaCollectionCompiler.Cleanup(that); return that; } internal XmlSchema DeepClone() { XmlSchema that = new XmlSchema(); that._attributeFormDefault = _attributeFormDefault; that._elementFormDefault = _elementFormDefault; that._blockDefault = _blockDefault; that._finalDefault = _finalDefault; that._targetNs = _targetNs; that._version = _version; that._isPreprocessed = _isPreprocessed; //that.IsProcessing = this.IsProcessing; //Not sure if this is needed //Clone its Items for (int i = 0; i < _items.Count; ++i) { XmlSchemaObject newItem; XmlSchemaComplexType? complexType; XmlSchemaElement? element; XmlSchemaGroup? group; if ((complexType = _items[i] as XmlSchemaComplexType) != null) { newItem = complexType.Clone(this); } else if ((element = _items[i] as XmlSchemaElement) != null) { newItem = element.Clone(this); } else if ((group = _items[i] as XmlSchemaGroup) != null) { newItem = group.Clone(this); } else { newItem = _items[i].Clone(); } that.Items.Add(newItem); } //Clone Includes for (int i = 0; i < _includes.Count; ++i) { XmlSchemaExternal newInclude = (XmlSchemaExternal)_includes[i].Clone(); that.Includes.Add(newInclude); } that.Namespaces = this.Namespaces; //that.includes = this.includes; //Need to verify this is OK for redefines that.BaseUri = this.BaseUri; return that; } [XmlIgnore] internal override string? IdAttribute { get { return Id; } set { Id = value; } } internal void SetIsCompiled(bool isCompiled) { _isCompiled = isCompiled; } internal override void SetUnhandledAttributes(XmlAttribute[] moreAttributes) { _moreAttributes = moreAttributes; } internal override void AddAnnotation(XmlSchemaAnnotation annotation) { _items.Add(annotation); } internal XmlNameTable NameTable { get { if (_nameTable == null) _nameTable = new System.Xml.NameTable(); return _nameTable; } } internal ArrayList ImportedSchemas { get { if (_importedSchemas == null) { _importedSchemas = new ArrayList(); } return _importedSchemas; } } internal ArrayList ImportedNamespaces { get { if (_importedNamespaces == null) { _importedNamespaces = new ArrayList(); } return _importedNamespaces; } } internal void GetExternalSchemasList(IList extList, XmlSchema schema) { Debug.Assert(extList != null && schema != null); if (extList.Contains(schema)) { return; } extList.Add(schema); for (int i = 0; i < schema.Includes.Count; ++i) { XmlSchemaExternal ext = (XmlSchemaExternal)schema.Includes[i]; if (ext.Schema != null) { GetExternalSchemasList(extList, ext.Schema); } } } #if TRUST_COMPILE_STATE internal void AddCompiledInfo(SchemaInfo schemaInfo) { XmlQualifiedName itemName; foreach (XmlSchemaElement element in elements.Values) { itemName = element.QualifiedName; schemaInfo.TargetNamespaces[itemName.Namespace] = true; if (schemaInfo.ElementDecls[itemName] == null) { schemaInfo.ElementDecls.Add(itemName, element.ElementDecl); } } foreach (XmlSchemaAttribute attribute in attributes.Values) { itemName = attribute.QualifiedName; schemaInfo.TargetNamespaces[itemName.Namespace] = true; if (schemaInfo.ElementDecls[itemName] == null) { schemaInfo.AttributeDecls.Add(itemName, attribute.AttDef); } } foreach (XmlSchemaType type in types.Values) { itemName = type.QualifiedName; schemaInfo.TargetNamespaces[itemName.Namespace] = true; XmlSchemaComplexType complexType = type as XmlSchemaComplexType; if ((complexType == null || type != XmlSchemaComplexType.AnyType) && schemaInfo.ElementDeclsByType[itemName] == null) { schemaInfo.ElementDeclsByType.Add(itemName, type.ElementDecl); } } foreach (XmlSchemaNotation notation in notations.Values) { itemName = notation.QualifiedName; schemaInfo.TargetNamespaces[itemName.Namespace] = true; SchemaNotation no = new SchemaNotation(itemName); no.SystemLiteral = notation.System; no.Pubid = notation.Public; if (schemaInfo.Notations[itemName.Name] == null) { schemaInfo.Notations.Add(itemName.Name, no); } } } #endif//TRUST_COMPILE_STATE } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.Xml.Schema { using System.IO; using System.Collections; using System.ComponentModel; using System.Xml.Serialization; using System.Threading; using System.Diagnostics; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; [XmlRoot("schema", Namespace = XmlSchema.Namespace)] public class XmlSchema : XmlSchemaObject { public const string Namespace = XmlReservedNs.NsXs; public const string InstanceNamespace = XmlReservedNs.NsXsi; private XmlSchemaForm _attributeFormDefault = XmlSchemaForm.None; private XmlSchemaForm _elementFormDefault = XmlSchemaForm.None; private XmlSchemaDerivationMethod _blockDefault = XmlSchemaDerivationMethod.None; private XmlSchemaDerivationMethod _finalDefault = XmlSchemaDerivationMethod.None; private string? _targetNs; private string? _version; private XmlSchemaObjectCollection _includes = new XmlSchemaObjectCollection(); private XmlSchemaObjectCollection _items = new XmlSchemaObjectCollection(); private string? _id; private XmlAttribute[]? _moreAttributes; // compiled info private bool _isCompiled; private bool _isCompiledBySet; private bool _isPreprocessed; private bool _isRedefined; private int _errorCount; private XmlSchemaObjectTable? _attributes; private XmlSchemaObjectTable _attributeGroups = new XmlSchemaObjectTable(); private XmlSchemaObjectTable _elements = new XmlSchemaObjectTable(); private XmlSchemaObjectTable _types = new XmlSchemaObjectTable(); private readonly XmlSchemaObjectTable _groups = new XmlSchemaObjectTable(); private readonly XmlSchemaObjectTable _notations = new XmlSchemaObjectTable(); private readonly XmlSchemaObjectTable _identityConstraints = new XmlSchemaObjectTable(); private static int s_globalIdCounter = -1; private ArrayList? _importedSchemas; private ArrayList? _importedNamespaces; private int _schemaId = -1; //Not added to a set private Uri? _baseUri; private bool _isChameleon; private readonly Hashtable _ids = new Hashtable(); private XmlDocument? _document; private XmlNameTable? _nameTable; public XmlSchema() { } public static XmlSchema? Read(TextReader reader, ValidationEventHandler? validationEventHandler) { return Read(new XmlTextReader(reader), validationEventHandler); } public static XmlSchema? Read(Stream stream, ValidationEventHandler? validationEventHandler) { return Read(new XmlTextReader(stream), validationEventHandler); } public static XmlSchema? Read(XmlReader reader, ValidationEventHandler? validationEventHandler) { XmlNameTable nameTable = reader.NameTable; Parser parser = new Parser(SchemaType.XSD, nameTable, new SchemaNames(nameTable), validationEventHandler); try { parser.Parse(reader, null); } catch (XmlSchemaException e) { if (validationEventHandler != null) { validationEventHandler(null, new ValidationEventArgs(e)); } else { throw; } return null; } return parser.XmlSchema; } [RequiresUnreferencedCode(XmlSerializer.TrimSerializationWarning)] public void Write(Stream stream) { Write(stream, null); } [RequiresUnreferencedCode(XmlSerializer.TrimSerializationWarning)] public void Write(Stream stream, XmlNamespaceManager? namespaceManager) { XmlTextWriter xmlWriter = new XmlTextWriter(stream, null); xmlWriter.Formatting = Formatting.Indented; Write(xmlWriter, namespaceManager); } [RequiresUnreferencedCode(XmlSerializer.TrimSerializationWarning)] public void Write(TextWriter writer) { Write(writer, null); } [RequiresUnreferencedCode(XmlSerializer.TrimSerializationWarning)] public void Write(TextWriter writer, XmlNamespaceManager? namespaceManager) { XmlTextWriter xmlWriter = new XmlTextWriter(writer); xmlWriter.Formatting = Formatting.Indented; Write(xmlWriter, namespaceManager); } [RequiresUnreferencedCode(XmlSerializer.TrimSerializationWarning)] public void Write(XmlWriter writer) { Write(writer, null); } [DynamicDependency(TrimmerConstants.PublicMembers, typeof(XmlSchema))] // This method may be safe given the above Dynamic Dependency but it is not yet fully understood if just preserving // all of XmlSchema public members is enough in order to be safe in all cases, so we have opted to keep the RequiresUnreferencedCode // attribute for now. This can be removed in the future if it is determined that the above is enough for all scenarios to be trim-safe. [RequiresUnreferencedCode(XmlSerializer.TrimSerializationWarning)] public void Write(XmlWriter writer, XmlNamespaceManager? namespaceManager) { XmlSerializer serializer = new XmlSerializer(typeof(XmlSchema)); XmlSerializerNamespaces ns; if (namespaceManager != null) { ns = new XmlSerializerNamespaces(); bool ignoreXS = false; if (this.Namespaces != null) { //User may have set both nsManager and Namespaces property on the XmlSchema object ignoreXS = this.Namespaces.TryLookupPrefix("xs", out _) || this.Namespaces.TryLookupNamespace(XmlReservedNs.NsXs, out _); } if (!ignoreXS && namespaceManager.LookupPrefix(XmlReservedNs.NsXs) == null && namespaceManager.LookupNamespace("xs") == null) { ns.Add("xs", XmlReservedNs.NsXs); } foreach (string prefix in namespaceManager) { if (prefix != "xml" && prefix != "xmlns") { ns.Add(prefix, namespaceManager.LookupNamespace(prefix!)); } } } else if (this.Namespaces != null && this.Namespaces.Count > 0) { if (!this.Namespaces.TryLookupPrefix("xs", out _) && !this.Namespaces.TryLookupNamespace(XmlReservedNs.NsXs, out _)) { //Prefix xs not defined AND schema namespace not already mapped to a prefix this.Namespaces.Add("xs", XmlReservedNs.NsXs); } ns = this.Namespaces; } else { ns = new XmlSerializerNamespaces(); ns.Add("xs", XmlSchema.Namespace); if (_targetNs != null && _targetNs.Length != 0) { ns.Add("tns", _targetNs); } } serializer.Serialize(writer, this, ns); } [Obsolete("XmlSchema.Compile has been deprecated. Use System.Xml.Schema.XmlSchemaSet for schema compilation and validation.")] public void Compile(ValidationEventHandler? validationEventHandler) { SchemaInfo sInfo = new SchemaInfo(); sInfo.SchemaType = SchemaType.XSD; CompileSchema(null, null, sInfo, null, validationEventHandler, NameTable, false); } [Obsolete("XmlSchema.Compile has been deprecated. Use System.Xml.Schema.XmlSchemaSet for schema compilation and validation.")] public void Compile(ValidationEventHandler? validationEventHandler, XmlResolver? resolver) { SchemaInfo sInfo = new SchemaInfo(); sInfo.SchemaType = SchemaType.XSD; CompileSchema(null, resolver, sInfo, null, validationEventHandler, NameTable, false); } #pragma warning disable 618 internal bool CompileSchema(XmlSchemaCollection? xsc, XmlResolver? resolver, SchemaInfo schemaInfo, string? ns, ValidationEventHandler? validationEventHandler, XmlNameTable nameTable, bool CompileContentModel) { //Need to lock here to prevent multi-threading problems when same schema is added to set and compiled lock (this) { //Preprocessing SchemaCollectionPreprocessor prep = new SchemaCollectionPreprocessor(nameTable, null, validationEventHandler); prep.XmlResolver = resolver; if (!prep.Execute(this, ns, true, xsc)) { return false; } //Compilation SchemaCollectionCompiler compiler = new SchemaCollectionCompiler(nameTable, validationEventHandler); _isCompiled = compiler.Execute(this, schemaInfo, CompileContentModel); this.SetIsCompiled(_isCompiled); return _isCompiled; } } #pragma warning restore 618 internal void CompileSchemaInSet(XmlNameTable nameTable, ValidationEventHandler? eventHandler, XmlSchemaCompilationSettings? compilationSettings) { Debug.Assert(_isPreprocessed); Compiler setCompiler = new Compiler(nameTable, eventHandler, null, compilationSettings); setCompiler.Prepare(this, true); _isCompiledBySet = setCompiler.Compile(); } [XmlAttribute("attributeFormDefault"), DefaultValue(XmlSchemaForm.None)] public XmlSchemaForm AttributeFormDefault { get { return _attributeFormDefault; } set { _attributeFormDefault = value; } } [XmlAttribute("blockDefault"), DefaultValue(XmlSchemaDerivationMethod.None)] public XmlSchemaDerivationMethod BlockDefault { get { return _blockDefault; } set { _blockDefault = value; } } [XmlAttribute("finalDefault"), DefaultValue(XmlSchemaDerivationMethod.None)] public XmlSchemaDerivationMethod FinalDefault { get { return _finalDefault; } set { _finalDefault = value; } } [XmlAttribute("elementFormDefault"), DefaultValue(XmlSchemaForm.None)] public XmlSchemaForm ElementFormDefault { get { return _elementFormDefault; } set { _elementFormDefault = value; } } [XmlAttribute("targetNamespace", DataType = "anyURI")] public string? TargetNamespace { get { return _targetNs; } set { _targetNs = value; } } [XmlAttribute("version", DataType = "token")] public string? Version { get { return _version; } set { _version = value; } } [XmlElement("include", typeof(XmlSchemaInclude)), XmlElement("import", typeof(XmlSchemaImport)), XmlElement("redefine", typeof(XmlSchemaRedefine))] public XmlSchemaObjectCollection Includes { get { return _includes; } } [XmlElement("annotation", typeof(XmlSchemaAnnotation)), XmlElement("attribute", typeof(XmlSchemaAttribute)), XmlElement("attributeGroup", typeof(XmlSchemaAttributeGroup)), XmlElement("complexType", typeof(XmlSchemaComplexType)), XmlElement("simpleType", typeof(XmlSchemaSimpleType)), XmlElement("element", typeof(XmlSchemaElement)), XmlElement("group", typeof(XmlSchemaGroup)), XmlElement("notation", typeof(XmlSchemaNotation))] public XmlSchemaObjectCollection Items { get { return _items; } } // Compiled info [XmlIgnore] public bool IsCompiled { get { return _isCompiled || _isCompiledBySet; } } [XmlIgnore] internal bool IsCompiledBySet { get { return _isCompiledBySet; } set { _isCompiledBySet = value; } } [XmlIgnore] internal bool IsPreprocessed { get { return _isPreprocessed; } set { _isPreprocessed = value; } } [XmlIgnore] internal bool IsRedefined { get { return _isRedefined; } set { _isRedefined = value; } } [XmlIgnore] public XmlSchemaObjectTable Attributes { get { if (_attributes == null) { _attributes = new XmlSchemaObjectTable(); } return _attributes; } } [XmlIgnore] public XmlSchemaObjectTable AttributeGroups { get { if (_attributeGroups == null) { _attributeGroups = new XmlSchemaObjectTable(); } return _attributeGroups; } } [XmlIgnore] public XmlSchemaObjectTable SchemaTypes { get { if (_types == null) { _types = new XmlSchemaObjectTable(); } return _types; } } [XmlIgnore] public XmlSchemaObjectTable Elements { get { if (_elements == null) { _elements = new XmlSchemaObjectTable(); } return _elements; } } [XmlAttribute("id", DataType = "ID")] public string? Id { get { return _id; } set { _id = value; } } [XmlAnyAttribute] public XmlAttribute[]? UnhandledAttributes { get { return _moreAttributes; } set { _moreAttributes = value; } } [XmlIgnore] public XmlSchemaObjectTable Groups { get { return _groups; } } [XmlIgnore] public XmlSchemaObjectTable Notations { get { return _notations; } } [XmlIgnore] internal XmlSchemaObjectTable IdentityConstraints { get { return _identityConstraints; } } [XmlIgnore] internal Uri? BaseUri { get { return _baseUri; } set { _baseUri = value; } } [XmlIgnore] // Please be careful with this property. Since it lazy initialized and its value depends on a global state // if it gets called on multiple schemas in a different order the schemas will end up with different IDs // Unfortunately the IDs are used to sort the schemas in the schema set and thus changing the IDs might change // the order which would be a breaking change!! // Simply put if you are planning to add or remove a call to this getter you need to be extra carefull // or better don't do it at all. internal int SchemaId { get { if (_schemaId == -1) { _schemaId = Interlocked.Increment(ref s_globalIdCounter); } return _schemaId; } } [XmlIgnore] internal bool IsChameleon { get { return _isChameleon; } set { _isChameleon = value; } } [XmlIgnore] internal Hashtable Ids { get { return _ids; } } [XmlIgnore] internal XmlDocument Document { get { if (_document == null) _document = new XmlDocument(); return _document; } } [XmlIgnore] internal int ErrorCount { get { return _errorCount; } set { _errorCount = value; } } internal new XmlSchema Clone() { XmlSchema that = new XmlSchema(); that._attributeFormDefault = _attributeFormDefault; that._elementFormDefault = _elementFormDefault; that._blockDefault = _blockDefault; that._finalDefault = _finalDefault; that._targetNs = _targetNs; that._version = _version; that._includes = _includes; that.Namespaces = this.Namespaces; that._items = _items; that.BaseUri = this.BaseUri; SchemaCollectionCompiler.Cleanup(that); return that; } internal XmlSchema DeepClone() { XmlSchema that = new XmlSchema(); that._attributeFormDefault = _attributeFormDefault; that._elementFormDefault = _elementFormDefault; that._blockDefault = _blockDefault; that._finalDefault = _finalDefault; that._targetNs = _targetNs; that._version = _version; that._isPreprocessed = _isPreprocessed; //that.IsProcessing = this.IsProcessing; //Not sure if this is needed //Clone its Items for (int i = 0; i < _items.Count; ++i) { XmlSchemaObject newItem; XmlSchemaComplexType? complexType; XmlSchemaElement? element; XmlSchemaGroup? group; if ((complexType = _items[i] as XmlSchemaComplexType) != null) { newItem = complexType.Clone(this); } else if ((element = _items[i] as XmlSchemaElement) != null) { newItem = element.Clone(this); } else if ((group = _items[i] as XmlSchemaGroup) != null) { newItem = group.Clone(this); } else { newItem = _items[i].Clone(); } that.Items.Add(newItem); } //Clone Includes for (int i = 0; i < _includes.Count; ++i) { XmlSchemaExternal newInclude = (XmlSchemaExternal)_includes[i].Clone(); that.Includes.Add(newInclude); } that.Namespaces = this.Namespaces; //that.includes = this.includes; //Need to verify this is OK for redefines that.BaseUri = this.BaseUri; return that; } [XmlIgnore] internal override string? IdAttribute { get { return Id; } set { Id = value; } } internal void SetIsCompiled(bool isCompiled) { _isCompiled = isCompiled; } internal override void SetUnhandledAttributes(XmlAttribute[] moreAttributes) { _moreAttributes = moreAttributes; } internal override void AddAnnotation(XmlSchemaAnnotation annotation) { _items.Add(annotation); } internal XmlNameTable NameTable { get { if (_nameTable == null) _nameTable = new System.Xml.NameTable(); return _nameTable; } } internal ArrayList ImportedSchemas { get { if (_importedSchemas == null) { _importedSchemas = new ArrayList(); } return _importedSchemas; } } internal ArrayList ImportedNamespaces { get { if (_importedNamespaces == null) { _importedNamespaces = new ArrayList(); } return _importedNamespaces; } } internal void GetExternalSchemasList(IList extList, XmlSchema schema) { Debug.Assert(extList != null && schema != null); if (extList.Contains(schema)) { return; } extList.Add(schema); for (int i = 0; i < schema.Includes.Count; ++i) { XmlSchemaExternal ext = (XmlSchemaExternal)schema.Includes[i]; if (ext.Schema != null) { GetExternalSchemasList(extList, ext.Schema); } } } #if TRUST_COMPILE_STATE internal void AddCompiledInfo(SchemaInfo schemaInfo) { XmlQualifiedName itemName; foreach (XmlSchemaElement element in elements.Values) { itemName = element.QualifiedName; schemaInfo.TargetNamespaces[itemName.Namespace] = true; if (schemaInfo.ElementDecls[itemName] == null) { schemaInfo.ElementDecls.Add(itemName, element.ElementDecl); } } foreach (XmlSchemaAttribute attribute in attributes.Values) { itemName = attribute.QualifiedName; schemaInfo.TargetNamespaces[itemName.Namespace] = true; if (schemaInfo.ElementDecls[itemName] == null) { schemaInfo.AttributeDecls.Add(itemName, attribute.AttDef); } } foreach (XmlSchemaType type in types.Values) { itemName = type.QualifiedName; schemaInfo.TargetNamespaces[itemName.Namespace] = true; XmlSchemaComplexType complexType = type as XmlSchemaComplexType; if ((complexType == null || type != XmlSchemaComplexType.AnyType) && schemaInfo.ElementDeclsByType[itemName] == null) { schemaInfo.ElementDeclsByType.Add(itemName, type.ElementDecl); } } foreach (XmlSchemaNotation notation in notations.Values) { itemName = notation.QualifiedName; schemaInfo.TargetNamespaces[itemName.Namespace] = true; SchemaNotation no = new SchemaNotation(itemName); no.SystemLiteral = notation.System; no.Pubid = notation.Public; if (schemaInfo.Notations[itemName.Name] == null) { schemaInfo.Notations.Add(itemName.Name, no); } } } #endif//TRUST_COMPILE_STATE } }
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/libraries/Microsoft.Extensions.DependencyInjection.Specification.Tests/src/Fakes/ClassImplementingIEnumerable.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Collections; namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { public class ClassImplementingIEnumerable : IEnumerable { public IEnumerator GetEnumerator() => throw new NotImplementedException(); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Collections; namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { public class ClassImplementingIEnumerable : IEnumerable { public IEnumerator GetEnumerator() => throw new NotImplementedException(); } }
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/libraries/Common/src/Interop/Windows/Advapi32/Interop.CreateService.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.Win32.SafeHandles; using System; using System.Runtime.InteropServices; internal static partial class Interop { internal static partial class Advapi32 { [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "CreateServiceW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)] public static partial IntPtr CreateService(SafeServiceHandle databaseHandle, string serviceName, string displayName, int access, int serviceType, int startType, int errorControl, string binaryPath, string loadOrderGroup, IntPtr pTagId, string dependencies, string servicesStartName, string password); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Microsoft.Win32.SafeHandles; using System; using System.Runtime.InteropServices; internal static partial class Interop { internal static partial class Advapi32 { [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "CreateServiceW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)] public static partial IntPtr CreateService(SafeServiceHandle databaseHandle, string serviceName, string displayName, int access, int serviceType, int startType, int errorControl, string binaryPath, string loadOrderGroup, IntPtr pTagId, string dependencies, string servicesStartName, string password); } }
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/libraries/System.Private.CoreLib/src/System/Globalization/SortVersion.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; namespace System.Globalization { [Serializable] [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed class SortVersion : IEquatable<SortVersion?> { private readonly int m_NlsVersion; // Do not rename (binary serialization) private Guid m_SortId; // Do not rename (binary serialization) public int FullVersion => m_NlsVersion; public Guid SortId => m_SortId; public SortVersion(int fullVersion, Guid sortId) { m_SortId = sortId; m_NlsVersion = fullVersion; } internal SortVersion(int nlsVersion, int effectiveId, Guid customVersion) { m_NlsVersion = nlsVersion; if (customVersion == Guid.Empty) { byte b1 = (byte)(effectiveId >> 24); byte b2 = (byte)((effectiveId & 0x00FF0000) >> 16); byte b3 = (byte)((effectiveId & 0x0000FF00) >> 8); byte b4 = (byte)(effectiveId & 0xFF); customVersion = new Guid(0, 0, 0, 0, 0, 0, 0, b1, b2, b3, b4); } m_SortId = customVersion; } public override bool Equals([NotNullWhen(true)] object? obj) { return obj is SortVersion otherVersion && Equals(otherVersion); } public bool Equals([NotNullWhen(true)] SortVersion? other) { if (other == null) { return false; } return m_NlsVersion == other.m_NlsVersion && m_SortId == other.m_SortId; } public override int GetHashCode() { return m_NlsVersion * 7 | m_SortId.GetHashCode(); } // Force inline as the true/false ternary takes it above ALWAYS_INLINE size even though the asm ends up smaller [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator ==(SortVersion? left, SortVersion? right) { // Test "right" first to allow branch elimination when inlined for null checks (== null) // so it can become a simple test if (right is null) { // return true/false not the test result https://github.com/dotnet/runtime/issues/4207 return (left is null) ? true : false; } return right.Equals(left); } public static bool operator !=(SortVersion? left, SortVersion? right) => !(left == right); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; namespace System.Globalization { [Serializable] [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed class SortVersion : IEquatable<SortVersion?> { private readonly int m_NlsVersion; // Do not rename (binary serialization) private Guid m_SortId; // Do not rename (binary serialization) public int FullVersion => m_NlsVersion; public Guid SortId => m_SortId; public SortVersion(int fullVersion, Guid sortId) { m_SortId = sortId; m_NlsVersion = fullVersion; } internal SortVersion(int nlsVersion, int effectiveId, Guid customVersion) { m_NlsVersion = nlsVersion; if (customVersion == Guid.Empty) { byte b1 = (byte)(effectiveId >> 24); byte b2 = (byte)((effectiveId & 0x00FF0000) >> 16); byte b3 = (byte)((effectiveId & 0x0000FF00) >> 8); byte b4 = (byte)(effectiveId & 0xFF); customVersion = new Guid(0, 0, 0, 0, 0, 0, 0, b1, b2, b3, b4); } m_SortId = customVersion; } public override bool Equals([NotNullWhen(true)] object? obj) { return obj is SortVersion otherVersion && Equals(otherVersion); } public bool Equals([NotNullWhen(true)] SortVersion? other) { if (other == null) { return false; } return m_NlsVersion == other.m_NlsVersion && m_SortId == other.m_SortId; } public override int GetHashCode() { return m_NlsVersion * 7 | m_SortId.GetHashCode(); } // Force inline as the true/false ternary takes it above ALWAYS_INLINE size even though the asm ends up smaller [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator ==(SortVersion? left, SortVersion? right) { // Test "right" first to allow branch elimination when inlined for null checks (== null) // so it can become a simple test if (right is null) { // return true/false not the test result https://github.com/dotnet/runtime/issues/4207 return (left is null) ? true : false; } return right.Equals(left); } public static bool operator !=(SortVersion? left, SortVersion? right) => !(left == right); } }
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/mono/mono/tests/array-vt.cs
using System; public struct Test { int a1; int a2; static public int Main () { Test[] tarray = new Test [20]; tarray[0].a1 = 1; tarray[0].a2 = 2; if (tarray[0].a1 + tarray[0].a2 != 3) return 1; return 0; } }
using System; public struct Test { int a1; int a2; static public int Main () { Test[] tarray = new Test [20]; tarray[0].a1 = 1; tarray[0].a2 = 2; if (tarray[0].a1 + tarray[0].a2 != 3) return 1; return 0; } }
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectWithParameterizedConstructorConverter.Large.Reflection.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Text.Json.Serialization.Metadata; namespace System.Text.Json.Serialization.Converters { /// <summary> /// Implementation of <cref>JsonObjectConverter{T}</cref> that supports the deserialization /// of JSON objects using parameterized constructors. /// </summary> internal sealed class LargeObjectWithParameterizedConstructorConverterWithReflection<T> : LargeObjectWithParameterizedConstructorConverter<T> where T : notnull { [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)] public LargeObjectWithParameterizedConstructorConverterWithReflection() { } [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)] internal override void ConfigureJsonTypeInfoUsingReflection(JsonTypeInfo jsonTypeInfo, JsonSerializerOptions options) { jsonTypeInfo.CreateObjectWithArgs = options.MemberAccessorStrategy.CreateParameterizedConstructor<T>(ConstructorInfo!); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Text.Json.Serialization.Metadata; namespace System.Text.Json.Serialization.Converters { /// <summary> /// Implementation of <cref>JsonObjectConverter{T}</cref> that supports the deserialization /// of JSON objects using parameterized constructors. /// </summary> internal sealed class LargeObjectWithParameterizedConstructorConverterWithReflection<T> : LargeObjectWithParameterizedConstructorConverter<T> where T : notnull { [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)] public LargeObjectWithParameterizedConstructorConverterWithReflection() { } [RequiresUnreferencedCode(JsonSerializer.SerializationUnreferencedCodeMessage)] internal override void ConfigureJsonTypeInfoUsingReflection(JsonTypeInfo jsonTypeInfo, JsonSerializerOptions options) { jsonTypeInfo.CreateObjectWithArgs = options.MemberAccessorStrategy.CreateParameterizedConstructor<T>(ConstructorInfo!); } } }
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/libraries/System.Console/tests/SyncTextReader.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.IO; using System.Text; using Xunit; [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "Not supported on Browser, iOS, MacCatalyst, or tvOS.")] public class SyncTextReader { // NOTE: These tests test the underlying SyncTextReader by // accessing the Console.In TextReader (which in fact is a SyncTextReader). static readonly string[] s_testLines = new string[] { "3232 Hello32 Hello 5032 Hello 50 532 Hello 50 5 aTrueaabcdbc1.23123.4561.23439505050System.ObjectHello World", "32", "", "32 Hello", "", "32 Hello 50", "", "32 Hello 50 5", "", "32 Hello 50 5 a", "", "True", "a", "abcd", "bc", "1.23", "123.456", "1.234", "39", "50", "50", "50", "System.Object", "Hello World", }; private static void Test(string content, Action action) { TextWriter savedStandardOutput = Console.Out; TextReader savedStandardInput = Console.In; try { using (MemoryStream memStream = new MemoryStream()) { // Write the content, but leave the stream open. using (StreamWriter sw = new StreamWriter(memStream, Encoding.Unicode, 1024, true)) { sw.Write(content); sw.Flush(); } memStream.Seek(0, SeekOrigin.Begin); using (StreamReader sr = new StreamReader(memStream)) { Console.SetIn(sr); action(); } } } finally { TextWriter oldWriter = Console.Out; Console.SetOut(savedStandardOutput); oldWriter.Dispose(); TextReader oldReader = Console.In; Console.SetIn(savedStandardInput); oldReader.Dispose(); } } [Fact] public void ReadToEnd() { var expected = string.Join(Environment.NewLine, s_testLines); Test(expected, () => { // Given, When var result = Console.In.ReadToEnd(); // Then Assert.Equal(expected, result); Assert.Equal(-1, Console.Read()); // We should be at EOF now. }); } [Fact] public void ReadBlock() { var expected = new[] { 'H', 'e', 'l', 'l', 'o' }; Test(new string(expected), () => { // Given var buffer = new char[expected.Length]; // When var result = Console.In.ReadBlock(buffer, 0, 5); // Then Assert.Equal(5, result); Assert.Equal(expected, buffer); Assert.Equal(-1, Console.Read()); // We should be at EOF now. }); } [Fact] public void Read() { var expected = new[] { 'H', 'e', 'l', 'l', 'o' }; Test(new string(expected), () => { // Given var buffer = new char[expected.Length]; // When var result = Console.In.Read(buffer, 0, 5); // Then Assert.Equal(5, result); Assert.Equal(expected, buffer); Assert.Equal(-1, Console.Read()); // We should be at EOF now. }); } [Fact] public void Peek() { const string expected = "ABC"; Test(expected, () => { foreach (char expectedChar in expected) { Assert.Equal(expectedChar, Console.In.Peek()); Assert.Equal(expectedChar, Console.In.Read()); } }); } [Fact] public void ReadToEndAsync() { var expected = string.Join(Environment.NewLine, s_testLines); Test(expected, () => { // Given, When var result = Console.In.ReadToEndAsync().Result; // Then Assert.Equal(expected, result); Assert.Equal(-1, Console.Read()); // We should be at EOF now. }); } [Fact] public void ReadBlockAsync() { var expected = new[] { 'H', 'e', 'l', 'l', 'o' }; Test(new string(expected), () => { // Given var buffer = new char[expected.Length]; // When var result = Console.In.ReadBlockAsync(buffer, 0, 5).Result; // Then Assert.Equal(5, result); Assert.Equal(expected, buffer); Assert.Equal(-1, Console.Read()); // We should be at EOF now. // Invalid args Assert.Throws<ArgumentNullException>(() => { Console.In.ReadBlockAsync(null, 0, 0); }); Assert.Throws<ArgumentOutOfRangeException>(() => { Console.In.ReadBlockAsync(new char[1], -1, 0); }); Assert.Throws<ArgumentOutOfRangeException>(() => { Console.In.ReadBlockAsync(new char[1], 0, -1); }); AssertExtensions.Throws<ArgumentException>(null, () => { Console.In.ReadBlockAsync(new char[1], 1, 1); }); }); } [Fact] public void ReadAsync() { var expected = new[] { 'H', 'e', 'l', 'l', 'o' }; Test(new string(expected), () => { // Given var buffer = new char[expected.Length]; // When var result = Console.In.ReadAsync(buffer, 0, 5).Result; // Then Assert.Equal(5, result); Assert.Equal(expected, buffer); Assert.Equal(-1, Console.Read()); // We should be at EOF now. // Invalid args Assert.Throws<ArgumentNullException>(() => { Console.In.ReadAsync(null, 0, 0); }); Assert.Throws<ArgumentOutOfRangeException>(() => { Console.In.ReadAsync(new char[1], -1, 0); }); Assert.Throws<ArgumentOutOfRangeException>(() => { Console.In.ReadAsync(new char[1], 0, -1); }); AssertExtensions.Throws<ArgumentException>(null, () => { Console.In.ReadAsync(new char[1], 1, 1); }); }); } [Fact] public void ReadLineAsync() { var expected = string.Join(Environment.NewLine, s_testLines); Test(expected, () => { for (int i = 0; i < s_testLines.Length; i++) { // Given, When var result = Console.In.ReadLineAsync().Result; // Then Assert.Equal(s_testLines[i], result); } Assert.Equal(-1, Console.Read()); }); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.IO; using System.Text; using Xunit; [SkipOnPlatform(TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "Not supported on Browser, iOS, MacCatalyst, or tvOS.")] public class SyncTextReader { // NOTE: These tests test the underlying SyncTextReader by // accessing the Console.In TextReader (which in fact is a SyncTextReader). static readonly string[] s_testLines = new string[] { "3232 Hello32 Hello 5032 Hello 50 532 Hello 50 5 aTrueaabcdbc1.23123.4561.23439505050System.ObjectHello World", "32", "", "32 Hello", "", "32 Hello 50", "", "32 Hello 50 5", "", "32 Hello 50 5 a", "", "True", "a", "abcd", "bc", "1.23", "123.456", "1.234", "39", "50", "50", "50", "System.Object", "Hello World", }; private static void Test(string content, Action action) { TextWriter savedStandardOutput = Console.Out; TextReader savedStandardInput = Console.In; try { using (MemoryStream memStream = new MemoryStream()) { // Write the content, but leave the stream open. using (StreamWriter sw = new StreamWriter(memStream, Encoding.Unicode, 1024, true)) { sw.Write(content); sw.Flush(); } memStream.Seek(0, SeekOrigin.Begin); using (StreamReader sr = new StreamReader(memStream)) { Console.SetIn(sr); action(); } } } finally { TextWriter oldWriter = Console.Out; Console.SetOut(savedStandardOutput); oldWriter.Dispose(); TextReader oldReader = Console.In; Console.SetIn(savedStandardInput); oldReader.Dispose(); } } [Fact] public void ReadToEnd() { var expected = string.Join(Environment.NewLine, s_testLines); Test(expected, () => { // Given, When var result = Console.In.ReadToEnd(); // Then Assert.Equal(expected, result); Assert.Equal(-1, Console.Read()); // We should be at EOF now. }); } [Fact] public void ReadBlock() { var expected = new[] { 'H', 'e', 'l', 'l', 'o' }; Test(new string(expected), () => { // Given var buffer = new char[expected.Length]; // When var result = Console.In.ReadBlock(buffer, 0, 5); // Then Assert.Equal(5, result); Assert.Equal(expected, buffer); Assert.Equal(-1, Console.Read()); // We should be at EOF now. }); } [Fact] public void Read() { var expected = new[] { 'H', 'e', 'l', 'l', 'o' }; Test(new string(expected), () => { // Given var buffer = new char[expected.Length]; // When var result = Console.In.Read(buffer, 0, 5); // Then Assert.Equal(5, result); Assert.Equal(expected, buffer); Assert.Equal(-1, Console.Read()); // We should be at EOF now. }); } [Fact] public void Peek() { const string expected = "ABC"; Test(expected, () => { foreach (char expectedChar in expected) { Assert.Equal(expectedChar, Console.In.Peek()); Assert.Equal(expectedChar, Console.In.Read()); } }); } [Fact] public void ReadToEndAsync() { var expected = string.Join(Environment.NewLine, s_testLines); Test(expected, () => { // Given, When var result = Console.In.ReadToEndAsync().Result; // Then Assert.Equal(expected, result); Assert.Equal(-1, Console.Read()); // We should be at EOF now. }); } [Fact] public void ReadBlockAsync() { var expected = new[] { 'H', 'e', 'l', 'l', 'o' }; Test(new string(expected), () => { // Given var buffer = new char[expected.Length]; // When var result = Console.In.ReadBlockAsync(buffer, 0, 5).Result; // Then Assert.Equal(5, result); Assert.Equal(expected, buffer); Assert.Equal(-1, Console.Read()); // We should be at EOF now. // Invalid args Assert.Throws<ArgumentNullException>(() => { Console.In.ReadBlockAsync(null, 0, 0); }); Assert.Throws<ArgumentOutOfRangeException>(() => { Console.In.ReadBlockAsync(new char[1], -1, 0); }); Assert.Throws<ArgumentOutOfRangeException>(() => { Console.In.ReadBlockAsync(new char[1], 0, -1); }); AssertExtensions.Throws<ArgumentException>(null, () => { Console.In.ReadBlockAsync(new char[1], 1, 1); }); }); } [Fact] public void ReadAsync() { var expected = new[] { 'H', 'e', 'l', 'l', 'o' }; Test(new string(expected), () => { // Given var buffer = new char[expected.Length]; // When var result = Console.In.ReadAsync(buffer, 0, 5).Result; // Then Assert.Equal(5, result); Assert.Equal(expected, buffer); Assert.Equal(-1, Console.Read()); // We should be at EOF now. // Invalid args Assert.Throws<ArgumentNullException>(() => { Console.In.ReadAsync(null, 0, 0); }); Assert.Throws<ArgumentOutOfRangeException>(() => { Console.In.ReadAsync(new char[1], -1, 0); }); Assert.Throws<ArgumentOutOfRangeException>(() => { Console.In.ReadAsync(new char[1], 0, -1); }); AssertExtensions.Throws<ArgumentException>(null, () => { Console.In.ReadAsync(new char[1], 1, 1); }); }); } [Fact] public void ReadLineAsync() { var expected = string.Join(Environment.NewLine, s_testLines); Test(expected, () => { for (int i = 0; i < s_testLines.Length; i++) { // Given, When var result = Console.In.ReadLineAsync().Result; // Then Assert.Equal(s_testLines[i], result); } Assert.Equal(-1, Console.Read()); }); } }
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/libraries/System.Net.Primitives/tests/PalTests/SocketAddressPalTest.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Collections.Generic; using System.Linq; using System.Net.Sockets; using Xunit; namespace System.Net.Primitives.PalTests { public class SocketAddressPalTests { public static object[][] AddressFamilyData = new object[][] { new object[] { AddressFamily.Unspecified }, new object[] { AddressFamily.Unix }, new object[] { AddressFamily.InterNetwork }, new object[] { AddressFamily.InterNetworkV6 } }; [Theory, MemberData(nameof(AddressFamilyData))] public void AddressFamily_Get_Set(AddressFamily family) { var buffer = new byte[16]; SocketAddressPal.SetAddressFamily(buffer, family); Assert.Equal(family, SocketAddressPal.GetAddressFamily(buffer)); } [Fact] public void AddressFamily_Get_Set_Throws() { var buffer = new byte[1]; Assert.ThrowsAny<Exception>(() => SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetwork)); Assert.ThrowsAny<Exception>(() => SocketAddressPal.GetAddressFamily(buffer)); } public static object[][] PortData = new object[][] { new object[] { (ushort)0 }, new object[] { (ushort)42 }, new object[] { (ushort)1024 }, new object[] { (ushort)65535 } }; [Theory, MemberData(nameof(PortData))] public void Port_Get_Set_IPv4(ushort port) { var buffer = new byte[SocketAddressPal.IPv4AddressSize]; SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetwork); SocketAddressPal.SetPort(buffer, port); Assert.Equal(port, SocketAddressPal.GetPort(buffer)); } [Theory, MemberData(nameof(PortData))] public void Port_Get_Set_IPv6(ushort port) { var buffer = new byte[SocketAddressPal.IPv6AddressSize]; SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetworkV6); SocketAddressPal.SetPort(buffer, port); Assert.Equal(port, SocketAddressPal.GetPort(buffer)); } [Fact] public void Port_Get_Set_Throws_IPv4() { var buffer = new byte[2]; SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetwork); Assert.ThrowsAny<Exception>(() => SocketAddressPal.SetPort(buffer, 0)); Assert.ThrowsAny<Exception>(() => SocketAddressPal.GetPort(buffer)); } [Fact] public void Port_Get_Set_Throws_IPv6() { var buffer = new byte[2]; SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetworkV6); Assert.ThrowsAny<Exception>(() => SocketAddressPal.SetPort(buffer, 0)); Assert.ThrowsAny<Exception>(() => SocketAddressPal.GetPort(buffer)); } public static object[][] IPv4AddressData = new object[][] { new object[] { 0x00000000 }, new object[] { 0x04030201 }, new object[] { 0x0100007F }, new object[] { 0xFFFFFFFF } }; [Theory, MemberData(nameof(IPv4AddressData))] public void IPv4Address_Get_Set(uint address) { var buffer = new byte[SocketAddressPal.IPv4AddressSize]; SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetwork); SocketAddressPal.SetIPv4Address(buffer, address); Assert.Equal(address, SocketAddressPal.GetIPv4Address(buffer)); } [Fact] public void IPv4Address_Get_Set_Throws() { var buffer = new byte[4]; SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetwork); Assert.ThrowsAny<Exception>(() => SocketAddressPal.SetIPv4Address(buffer, 0)); Assert.ThrowsAny<Exception>(() => SocketAddressPal.GetIPv4Address(buffer)); } public static object[][] IPv6AddressData = new object[][] { new object[] { new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }, (uint)0 }, new object[] { new byte[] { 0x20, 0x01, 0x0d, 0x0b8, 0xaa, 0xaa, 0xbb, 0xbb, 0xcc, 0xcc, 0xdd, 0xdd, 0xee, 0xee, 0x00, 0x01 }, (uint)0xffeeddcc }, new object[] { new byte[] { 0x20, 0x01, 0x0d, 0x0b8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }, (uint)0xccddeeff }, new object[] { new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 222, 1, 41, 90 }, (uint)0 } }; [Theory, MemberData(nameof(IPv6AddressData))] public void IPv6Address_Get_Set(byte[] address, uint scope) { var buffer = new byte[SocketAddressPal.IPv6AddressSize]; SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetworkV6); SocketAddressPal.SetIPv6Address(buffer, address, scope); var actualAddress = new byte[address.Length]; uint actualScope; SocketAddressPal.GetIPv6Address(buffer, actualAddress, out actualScope); for (var i = 0; i < actualAddress.Length; i++) { Assert.Equal(address[i], actualAddress[i]); } Assert.Equal(scope, actualScope); } [Fact] public void IPv6Address_Get_Set_Throws() { uint unused; var buffer = new byte[4]; SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetworkV6); Assert.ThrowsAny<Exception>(() => SocketAddressPal.SetIPv6Address(buffer, new byte[16], 0)); Assert.ThrowsAny<Exception>(() => SocketAddressPal.GetIPv6Address(buffer, new byte[16], out unused)); } public static IEnumerable<object[]> IPv4AddressAndPortData = IPv4AddressData.SelectMany(o => PortData.Select(p => o.Concat(p))).Select(o => o.ToArray()); [Theory, MemberData(nameof(IPv4AddressAndPortData))] public void IPv4AddressAndPort_Get_Set(uint address, ushort port) { var buffer = new byte[SocketAddressPal.IPv4AddressSize]; SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetwork); SocketAddressPal.SetIPv4Address(buffer, address); SocketAddressPal.SetPort(buffer, port); Assert.Equal(address, SocketAddressPal.GetIPv4Address(buffer)); Assert.Equal(port, SocketAddressPal.GetPort(buffer)); } public static IEnumerable<object[]> IPv6AddressAndPortData = IPv6AddressData.SelectMany(o => PortData.Select(p => o.Concat(p))).Select(o => o.ToArray()); [Theory, MemberData(nameof(IPv6AddressAndPortData))] public void IPv6AddressAndPort_Get_Set(byte[] address, uint scope, ushort port) { var buffer = new byte[SocketAddressPal.IPv6AddressSize]; SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetworkV6); SocketAddressPal.SetIPv6Address(buffer, address, scope); SocketAddressPal.SetPort(buffer, port); var actualAddress = new byte[address.Length]; uint actualScope; SocketAddressPal.GetIPv6Address(buffer, actualAddress, out actualScope); for (var i = 0; i < actualAddress.Length; i++) { Assert.Equal(address[i], actualAddress[i]); } Assert.Equal(scope, actualScope); Assert.Equal(port, SocketAddressPal.GetPort(buffer)); } [Fact] public void ToString_ValidSocketAddress_ExpectedFormat() { IPEndPoint ipLocalEndPoint = new IPEndPoint(IPAddress.Loopback, Convert.ToInt32("cafe", 16)); SocketAddress socketAddress = ipLocalEndPoint.Serialize(); Assert.Equal("InterNetwork:16:{202,254,127,0,0,1,0,0,0,0,0,0,0,0}", socketAddress.ToString()); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Collections.Generic; using System.Linq; using System.Net.Sockets; using Xunit; namespace System.Net.Primitives.PalTests { public class SocketAddressPalTests { public static object[][] AddressFamilyData = new object[][] { new object[] { AddressFamily.Unspecified }, new object[] { AddressFamily.Unix }, new object[] { AddressFamily.InterNetwork }, new object[] { AddressFamily.InterNetworkV6 } }; [Theory, MemberData(nameof(AddressFamilyData))] public void AddressFamily_Get_Set(AddressFamily family) { var buffer = new byte[16]; SocketAddressPal.SetAddressFamily(buffer, family); Assert.Equal(family, SocketAddressPal.GetAddressFamily(buffer)); } [Fact] public void AddressFamily_Get_Set_Throws() { var buffer = new byte[1]; Assert.ThrowsAny<Exception>(() => SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetwork)); Assert.ThrowsAny<Exception>(() => SocketAddressPal.GetAddressFamily(buffer)); } public static object[][] PortData = new object[][] { new object[] { (ushort)0 }, new object[] { (ushort)42 }, new object[] { (ushort)1024 }, new object[] { (ushort)65535 } }; [Theory, MemberData(nameof(PortData))] public void Port_Get_Set_IPv4(ushort port) { var buffer = new byte[SocketAddressPal.IPv4AddressSize]; SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetwork); SocketAddressPal.SetPort(buffer, port); Assert.Equal(port, SocketAddressPal.GetPort(buffer)); } [Theory, MemberData(nameof(PortData))] public void Port_Get_Set_IPv6(ushort port) { var buffer = new byte[SocketAddressPal.IPv6AddressSize]; SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetworkV6); SocketAddressPal.SetPort(buffer, port); Assert.Equal(port, SocketAddressPal.GetPort(buffer)); } [Fact] public void Port_Get_Set_Throws_IPv4() { var buffer = new byte[2]; SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetwork); Assert.ThrowsAny<Exception>(() => SocketAddressPal.SetPort(buffer, 0)); Assert.ThrowsAny<Exception>(() => SocketAddressPal.GetPort(buffer)); } [Fact] public void Port_Get_Set_Throws_IPv6() { var buffer = new byte[2]; SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetworkV6); Assert.ThrowsAny<Exception>(() => SocketAddressPal.SetPort(buffer, 0)); Assert.ThrowsAny<Exception>(() => SocketAddressPal.GetPort(buffer)); } public static object[][] IPv4AddressData = new object[][] { new object[] { 0x00000000 }, new object[] { 0x04030201 }, new object[] { 0x0100007F }, new object[] { 0xFFFFFFFF } }; [Theory, MemberData(nameof(IPv4AddressData))] public void IPv4Address_Get_Set(uint address) { var buffer = new byte[SocketAddressPal.IPv4AddressSize]; SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetwork); SocketAddressPal.SetIPv4Address(buffer, address); Assert.Equal(address, SocketAddressPal.GetIPv4Address(buffer)); } [Fact] public void IPv4Address_Get_Set_Throws() { var buffer = new byte[4]; SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetwork); Assert.ThrowsAny<Exception>(() => SocketAddressPal.SetIPv4Address(buffer, 0)); Assert.ThrowsAny<Exception>(() => SocketAddressPal.GetIPv4Address(buffer)); } public static object[][] IPv6AddressData = new object[][] { new object[] { new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }, (uint)0 }, new object[] { new byte[] { 0x20, 0x01, 0x0d, 0x0b8, 0xaa, 0xaa, 0xbb, 0xbb, 0xcc, 0xcc, 0xdd, 0xdd, 0xee, 0xee, 0x00, 0x01 }, (uint)0xffeeddcc }, new object[] { new byte[] { 0x20, 0x01, 0x0d, 0x0b8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }, (uint)0xccddeeff }, new object[] { new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 222, 1, 41, 90 }, (uint)0 } }; [Theory, MemberData(nameof(IPv6AddressData))] public void IPv6Address_Get_Set(byte[] address, uint scope) { var buffer = new byte[SocketAddressPal.IPv6AddressSize]; SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetworkV6); SocketAddressPal.SetIPv6Address(buffer, address, scope); var actualAddress = new byte[address.Length]; uint actualScope; SocketAddressPal.GetIPv6Address(buffer, actualAddress, out actualScope); for (var i = 0; i < actualAddress.Length; i++) { Assert.Equal(address[i], actualAddress[i]); } Assert.Equal(scope, actualScope); } [Fact] public void IPv6Address_Get_Set_Throws() { uint unused; var buffer = new byte[4]; SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetworkV6); Assert.ThrowsAny<Exception>(() => SocketAddressPal.SetIPv6Address(buffer, new byte[16], 0)); Assert.ThrowsAny<Exception>(() => SocketAddressPal.GetIPv6Address(buffer, new byte[16], out unused)); } public static IEnumerable<object[]> IPv4AddressAndPortData = IPv4AddressData.SelectMany(o => PortData.Select(p => o.Concat(p))).Select(o => o.ToArray()); [Theory, MemberData(nameof(IPv4AddressAndPortData))] public void IPv4AddressAndPort_Get_Set(uint address, ushort port) { var buffer = new byte[SocketAddressPal.IPv4AddressSize]; SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetwork); SocketAddressPal.SetIPv4Address(buffer, address); SocketAddressPal.SetPort(buffer, port); Assert.Equal(address, SocketAddressPal.GetIPv4Address(buffer)); Assert.Equal(port, SocketAddressPal.GetPort(buffer)); } public static IEnumerable<object[]> IPv6AddressAndPortData = IPv6AddressData.SelectMany(o => PortData.Select(p => o.Concat(p))).Select(o => o.ToArray()); [Theory, MemberData(nameof(IPv6AddressAndPortData))] public void IPv6AddressAndPort_Get_Set(byte[] address, uint scope, ushort port) { var buffer = new byte[SocketAddressPal.IPv6AddressSize]; SocketAddressPal.SetAddressFamily(buffer, AddressFamily.InterNetworkV6); SocketAddressPal.SetIPv6Address(buffer, address, scope); SocketAddressPal.SetPort(buffer, port); var actualAddress = new byte[address.Length]; uint actualScope; SocketAddressPal.GetIPv6Address(buffer, actualAddress, out actualScope); for (var i = 0; i < actualAddress.Length; i++) { Assert.Equal(address[i], actualAddress[i]); } Assert.Equal(scope, actualScope); Assert.Equal(port, SocketAddressPal.GetPort(buffer)); } [Fact] public void ToString_ValidSocketAddress_ExpectedFormat() { IPEndPoint ipLocalEndPoint = new IPEndPoint(IPAddress.Loopback, Convert.ToInt32("cafe", 16)); SocketAddress socketAddress = ipLocalEndPoint.Serialize(); Assert.Equal("InterNetwork:16:{202,254,127,0,0,1,0,0,0,0,0,0,0,0}", socketAddress.ToString()); } } }
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/tests/JIT/Methodical/explicit/misc/explicit4_d.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="explicit4.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="explicit4.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./eng/common/post-build/sourcelink-validation.ps1
param( [Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where Symbols.NuGet packages to be checked are stored [Parameter(Mandatory=$true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation [Parameter(Mandatory=$false)][string] $GHRepoName, # GitHub name of the repo including the Org. E.g., dotnet/arcade [Parameter(Mandatory=$false)][string] $GHCommit, # GitHub commit SHA used to build the packages [Parameter(Mandatory=$true)][string] $SourcelinkCliVersion # Version of SourceLink CLI to use ) . $PSScriptRoot\post-build-utils.ps1 # Cache/HashMap (File -> Exist flag) used to consult whether a file exist # in the repository at a specific commit point. This is populated by inserting # all files present in the repo at a specific commit point. $global:RepoFiles = @{} # Maximum number of jobs to run in parallel $MaxParallelJobs = 16 $MaxRetries = 5 $RetryWaitTimeInSeconds = 30 # Wait time between check for system load $SecondsBetweenLoadChecks = 10 if (!$InputPath -or !(Test-Path $InputPath)){ Write-Host "No files to validate." ExitWithExitCode 0 } $ValidatePackage = { param( [string] $PackagePath # Full path to a Symbols.NuGet package ) . $using:PSScriptRoot\..\tools.ps1 # Ensure input file exist if (!(Test-Path $PackagePath)) { Write-Host "Input file does not exist: $PackagePath" return [pscustomobject]@{ result = 1 packagePath = $PackagePath } } # Extensions for which we'll look for SourceLink information # For now we'll only care about Portable & Embedded PDBs $RelevantExtensions = @('.dll', '.exe', '.pdb') Write-Host -NoNewLine 'Validating ' ([System.IO.Path]::GetFileName($PackagePath)) '...' $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) $ExtractPath = Join-Path -Path $using:ExtractPath -ChildPath $PackageId $FailedFiles = 0 Add-Type -AssemblyName System.IO.Compression.FileSystem [System.IO.Directory]::CreateDirectory($ExtractPath) | Out-Null try { $zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath) $zip.Entries | Where-Object {$RelevantExtensions -contains [System.IO.Path]::GetExtension($_.Name)} | ForEach-Object { $FileName = $_.FullName $Extension = [System.IO.Path]::GetExtension($_.Name) $FakeName = -Join((New-Guid), $Extension) $TargetFile = Join-Path -Path $ExtractPath -ChildPath $FakeName # We ignore resource DLLs if ($FileName.EndsWith('.resources.dll')) { return [pscustomobject]@{ result = 0 packagePath = $PackagePath } } [System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile, $true) $ValidateFile = { param( [string] $FullPath, # Full path to the module that has to be checked [string] $RealPath, [ref] $FailedFiles ) $sourcelinkExe = "$env:USERPROFILE\.dotnet\tools" $sourcelinkExe = Resolve-Path "$sourcelinkExe\sourcelink.exe" $SourceLinkInfos = & $sourcelinkExe print-urls $FullPath | Out-String if ($LASTEXITCODE -eq 0 -and -not ([string]::IsNullOrEmpty($SourceLinkInfos))) { $NumFailedLinks = 0 # We only care about Http addresses $Matches = (Select-String '(http[s]?)(:\/\/)([^\s,]+)' -Input $SourceLinkInfos -AllMatches).Matches if ($Matches.Count -ne 0) { $Matches.Value | ForEach-Object { $Link = $_ $CommitUrl = "https://raw.githubusercontent.com/${using:GHRepoName}/${using:GHCommit}/" $FilePath = $Link.Replace($CommitUrl, "") $Status = 200 $Cache = $using:RepoFiles $attempts = 0 while ($attempts -lt $using:MaxRetries) { if ( !($Cache.ContainsKey($FilePath)) ) { try { $Uri = $Link -as [System.URI] if ($Link -match "submodules") { # Skip submodule links until sourcelink properly handles submodules $Status = 200 } elseif ($Uri.AbsoluteURI -ne $null -and ($Uri.Host -match 'github' -or $Uri.Host -match 'githubusercontent')) { # Only GitHub links are valid $Status = (Invoke-WebRequest -Uri $Link -UseBasicParsing -Method HEAD -TimeoutSec 5).StatusCode } else { # If it's not a github link, we want to break out of the loop and not retry. $Status = 0 $attempts = $using:MaxRetries } } catch { Write-Host $_ $Status = 0 } } if ($Status -ne 200) { $attempts++ if ($attempts -lt $using:MaxRetries) { $attemptsLeft = $using:MaxRetries - $attempts Write-Warning "Download failed, $attemptsLeft attempts remaining, will retry in $using:RetryWaitTimeInSeconds seconds" Start-Sleep -Seconds $using:RetryWaitTimeInSeconds } else { if ($NumFailedLinks -eq 0) { if ($FailedFiles.Value -eq 0) { Write-Host } Write-Host "`tFile $RealPath has broken links:" } Write-Host "`t`tFailed to retrieve $Link" $NumFailedLinks++ } } else { break } } } } if ($NumFailedLinks -ne 0) { $FailedFiles.value++ $global:LASTEXITCODE = 1 } } } &$ValidateFile $TargetFile $FileName ([ref]$FailedFiles) } } catch { Write-Host $_ } finally { $zip.Dispose() } if ($FailedFiles -eq 0) { Write-Host 'Passed.' return [pscustomobject]@{ result = 0 packagePath = $PackagePath } } else { Write-PipelineTelemetryError -Category 'SourceLink' -Message "$PackagePath has broken SourceLink links." return [pscustomobject]@{ result = 1 packagePath = $PackagePath } } } function CheckJobResult( $result, $packagePath, [ref]$ValidationFailures, [switch]$logErrors) { if ($result -ne '0') { if ($logErrors) { Write-PipelineTelemetryError -Category 'SourceLink' -Message "$packagePath has broken SourceLink links." } $ValidationFailures.Value++ } } function ValidateSourceLinkLinks { if ($GHRepoName -ne '' -and !($GHRepoName -Match '^[^\s\/]+/[^\s\/]+$')) { if (!($GHRepoName -Match '^[^\s-]+-[^\s]+$')) { Write-PipelineTelemetryError -Category 'SourceLink' -Message "GHRepoName should be in the format <org>/<repo> or <org>-<repo>. '$GHRepoName'" ExitWithExitCode 1 } else { $GHRepoName = $GHRepoName -replace '^([^\s-]+)-([^\s]+)$', '$1/$2'; } } if ($GHCommit -ne '' -and !($GHCommit -Match '^[0-9a-fA-F]{40}$')) { Write-PipelineTelemetryError -Category 'SourceLink' -Message "GHCommit should be a 40 chars hexadecimal string. '$GHCommit'" ExitWithExitCode 1 } if ($GHRepoName -ne '' -and $GHCommit -ne '') { $RepoTreeURL = -Join('http://api.github.com/repos/', $GHRepoName, '/git/trees/', $GHCommit, '?recursive=1') $CodeExtensions = @('.cs', '.vb', '.fs', '.fsi', '.fsx', '.fsscript') try { # Retrieve the list of files in the repo at that particular commit point and store them in the RepoFiles hash $Data = Invoke-WebRequest $RepoTreeURL -UseBasicParsing | ConvertFrom-Json | Select-Object -ExpandProperty tree foreach ($file in $Data) { $Extension = [System.IO.Path]::GetExtension($file.path) if ($CodeExtensions.Contains($Extension)) { $RepoFiles[$file.path] = 1 } } } catch { Write-Host "Problems downloading the list of files from the repo. Url used: $RepoTreeURL . Execution will proceed without caching." } } elseif ($GHRepoName -ne '' -or $GHCommit -ne '') { Write-Host 'For using the http caching mechanism both GHRepoName and GHCommit should be informed.' } if (Test-Path $ExtractPath) { Remove-Item $ExtractPath -Force -Recurse -ErrorAction SilentlyContinue } $ValidationFailures = 0 # Process each NuGet package in parallel Get-ChildItem "$InputPath\*.symbols.nupkg" | ForEach-Object { Write-Host "Starting $($_.FullName)" Start-Job -ScriptBlock $ValidatePackage -ArgumentList $_.FullName | Out-Null $NumJobs = @(Get-Job -State 'Running').Count while ($NumJobs -ge $MaxParallelJobs) { Write-Host "There are $NumJobs validation jobs running right now. Waiting $SecondsBetweenLoadChecks seconds to check again." sleep $SecondsBetweenLoadChecks $NumJobs = @(Get-Job -State 'Running').Count } foreach ($Job in @(Get-Job -State 'Completed')) { $jobResult = Wait-Job -Id $Job.Id | Receive-Job CheckJobResult $jobResult.result $jobResult.packagePath ([ref]$ValidationFailures) -LogErrors Remove-Job -Id $Job.Id } } foreach ($Job in @(Get-Job)) { $jobResult = Wait-Job -Id $Job.Id | Receive-Job CheckJobResult $jobResult.result $jobResult.packagePath ([ref]$ValidationFailures) Remove-Job -Id $Job.Id } if ($ValidationFailures -gt 0) { Write-PipelineTelemetryError -Category 'SourceLink' -Message "$ValidationFailures package(s) failed validation." ExitWithExitCode 1 } } function InstallSourcelinkCli { $sourcelinkCliPackageName = 'sourcelink' $dotnetRoot = InitializeDotNetCli -install:$true $dotnet = "$dotnetRoot\dotnet.exe" $toolList = & "$dotnet" tool list --global if (($toolList -like "*$sourcelinkCliPackageName*") -and ($toolList -like "*$sourcelinkCliVersion*")) { Write-Host "SourceLink CLI version $sourcelinkCliVersion is already installed." } else { Write-Host "Installing SourceLink CLI version $sourcelinkCliVersion..." Write-Host 'You may need to restart your command window if this is the first dotnet tool you have installed.' & "$dotnet" tool install $sourcelinkCliPackageName --version $sourcelinkCliVersion --verbosity "minimal" --global } } try { InstallSourcelinkCli foreach ($Job in @(Get-Job)) { Remove-Job -Id $Job.Id } ValidateSourceLinkLinks } catch { Write-Host $_.Exception Write-Host $_.ScriptStackTrace Write-PipelineTelemetryError -Category 'SourceLink' -Message $_ ExitWithExitCode 1 }
param( [Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where Symbols.NuGet packages to be checked are stored [Parameter(Mandatory=$true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation [Parameter(Mandatory=$false)][string] $GHRepoName, # GitHub name of the repo including the Org. E.g., dotnet/arcade [Parameter(Mandatory=$false)][string] $GHCommit, # GitHub commit SHA used to build the packages [Parameter(Mandatory=$true)][string] $SourcelinkCliVersion # Version of SourceLink CLI to use ) . $PSScriptRoot\post-build-utils.ps1 # Cache/HashMap (File -> Exist flag) used to consult whether a file exist # in the repository at a specific commit point. This is populated by inserting # all files present in the repo at a specific commit point. $global:RepoFiles = @{} # Maximum number of jobs to run in parallel $MaxParallelJobs = 16 $MaxRetries = 5 $RetryWaitTimeInSeconds = 30 # Wait time between check for system load $SecondsBetweenLoadChecks = 10 if (!$InputPath -or !(Test-Path $InputPath)){ Write-Host "No files to validate." ExitWithExitCode 0 } $ValidatePackage = { param( [string] $PackagePath # Full path to a Symbols.NuGet package ) . $using:PSScriptRoot\..\tools.ps1 # Ensure input file exist if (!(Test-Path $PackagePath)) { Write-Host "Input file does not exist: $PackagePath" return [pscustomobject]@{ result = 1 packagePath = $PackagePath } } # Extensions for which we'll look for SourceLink information # For now we'll only care about Portable & Embedded PDBs $RelevantExtensions = @('.dll', '.exe', '.pdb') Write-Host -NoNewLine 'Validating ' ([System.IO.Path]::GetFileName($PackagePath)) '...' $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) $ExtractPath = Join-Path -Path $using:ExtractPath -ChildPath $PackageId $FailedFiles = 0 Add-Type -AssemblyName System.IO.Compression.FileSystem [System.IO.Directory]::CreateDirectory($ExtractPath) | Out-Null try { $zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath) $zip.Entries | Where-Object {$RelevantExtensions -contains [System.IO.Path]::GetExtension($_.Name)} | ForEach-Object { $FileName = $_.FullName $Extension = [System.IO.Path]::GetExtension($_.Name) $FakeName = -Join((New-Guid), $Extension) $TargetFile = Join-Path -Path $ExtractPath -ChildPath $FakeName # We ignore resource DLLs if ($FileName.EndsWith('.resources.dll')) { return [pscustomobject]@{ result = 0 packagePath = $PackagePath } } [System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile, $true) $ValidateFile = { param( [string] $FullPath, # Full path to the module that has to be checked [string] $RealPath, [ref] $FailedFiles ) $sourcelinkExe = "$env:USERPROFILE\.dotnet\tools" $sourcelinkExe = Resolve-Path "$sourcelinkExe\sourcelink.exe" $SourceLinkInfos = & $sourcelinkExe print-urls $FullPath | Out-String if ($LASTEXITCODE -eq 0 -and -not ([string]::IsNullOrEmpty($SourceLinkInfos))) { $NumFailedLinks = 0 # We only care about Http addresses $Matches = (Select-String '(http[s]?)(:\/\/)([^\s,]+)' -Input $SourceLinkInfos -AllMatches).Matches if ($Matches.Count -ne 0) { $Matches.Value | ForEach-Object { $Link = $_ $CommitUrl = "https://raw.githubusercontent.com/${using:GHRepoName}/${using:GHCommit}/" $FilePath = $Link.Replace($CommitUrl, "") $Status = 200 $Cache = $using:RepoFiles $attempts = 0 while ($attempts -lt $using:MaxRetries) { if ( !($Cache.ContainsKey($FilePath)) ) { try { $Uri = $Link -as [System.URI] if ($Link -match "submodules") { # Skip submodule links until sourcelink properly handles submodules $Status = 200 } elseif ($Uri.AbsoluteURI -ne $null -and ($Uri.Host -match 'github' -or $Uri.Host -match 'githubusercontent')) { # Only GitHub links are valid $Status = (Invoke-WebRequest -Uri $Link -UseBasicParsing -Method HEAD -TimeoutSec 5).StatusCode } else { # If it's not a github link, we want to break out of the loop and not retry. $Status = 0 $attempts = $using:MaxRetries } } catch { Write-Host $_ $Status = 0 } } if ($Status -ne 200) { $attempts++ if ($attempts -lt $using:MaxRetries) { $attemptsLeft = $using:MaxRetries - $attempts Write-Warning "Download failed, $attemptsLeft attempts remaining, will retry in $using:RetryWaitTimeInSeconds seconds" Start-Sleep -Seconds $using:RetryWaitTimeInSeconds } else { if ($NumFailedLinks -eq 0) { if ($FailedFiles.Value -eq 0) { Write-Host } Write-Host "`tFile $RealPath has broken links:" } Write-Host "`t`tFailed to retrieve $Link" $NumFailedLinks++ } } else { break } } } } if ($NumFailedLinks -ne 0) { $FailedFiles.value++ $global:LASTEXITCODE = 1 } } } &$ValidateFile $TargetFile $FileName ([ref]$FailedFiles) } } catch { Write-Host $_ } finally { $zip.Dispose() } if ($FailedFiles -eq 0) { Write-Host 'Passed.' return [pscustomobject]@{ result = 0 packagePath = $PackagePath } } else { Write-PipelineTelemetryError -Category 'SourceLink' -Message "$PackagePath has broken SourceLink links." return [pscustomobject]@{ result = 1 packagePath = $PackagePath } } } function CheckJobResult( $result, $packagePath, [ref]$ValidationFailures, [switch]$logErrors) { if ($result -ne '0') { if ($logErrors) { Write-PipelineTelemetryError -Category 'SourceLink' -Message "$packagePath has broken SourceLink links." } $ValidationFailures.Value++ } } function ValidateSourceLinkLinks { if ($GHRepoName -ne '' -and !($GHRepoName -Match '^[^\s\/]+/[^\s\/]+$')) { if (!($GHRepoName -Match '^[^\s-]+-[^\s]+$')) { Write-PipelineTelemetryError -Category 'SourceLink' -Message "GHRepoName should be in the format <org>/<repo> or <org>-<repo>. '$GHRepoName'" ExitWithExitCode 1 } else { $GHRepoName = $GHRepoName -replace '^([^\s-]+)-([^\s]+)$', '$1/$2'; } } if ($GHCommit -ne '' -and !($GHCommit -Match '^[0-9a-fA-F]{40}$')) { Write-PipelineTelemetryError -Category 'SourceLink' -Message "GHCommit should be a 40 chars hexadecimal string. '$GHCommit'" ExitWithExitCode 1 } if ($GHRepoName -ne '' -and $GHCommit -ne '') { $RepoTreeURL = -Join('http://api.github.com/repos/', $GHRepoName, '/git/trees/', $GHCommit, '?recursive=1') $CodeExtensions = @('.cs', '.vb', '.fs', '.fsi', '.fsx', '.fsscript') try { # Retrieve the list of files in the repo at that particular commit point and store them in the RepoFiles hash $Data = Invoke-WebRequest $RepoTreeURL -UseBasicParsing | ConvertFrom-Json | Select-Object -ExpandProperty tree foreach ($file in $Data) { $Extension = [System.IO.Path]::GetExtension($file.path) if ($CodeExtensions.Contains($Extension)) { $RepoFiles[$file.path] = 1 } } } catch { Write-Host "Problems downloading the list of files from the repo. Url used: $RepoTreeURL . Execution will proceed without caching." } } elseif ($GHRepoName -ne '' -or $GHCommit -ne '') { Write-Host 'For using the http caching mechanism both GHRepoName and GHCommit should be informed.' } if (Test-Path $ExtractPath) { Remove-Item $ExtractPath -Force -Recurse -ErrorAction SilentlyContinue } $ValidationFailures = 0 # Process each NuGet package in parallel Get-ChildItem "$InputPath\*.symbols.nupkg" | ForEach-Object { Write-Host "Starting $($_.FullName)" Start-Job -ScriptBlock $ValidatePackage -ArgumentList $_.FullName | Out-Null $NumJobs = @(Get-Job -State 'Running').Count while ($NumJobs -ge $MaxParallelJobs) { Write-Host "There are $NumJobs validation jobs running right now. Waiting $SecondsBetweenLoadChecks seconds to check again." sleep $SecondsBetweenLoadChecks $NumJobs = @(Get-Job -State 'Running').Count } foreach ($Job in @(Get-Job -State 'Completed')) { $jobResult = Wait-Job -Id $Job.Id | Receive-Job CheckJobResult $jobResult.result $jobResult.packagePath ([ref]$ValidationFailures) -LogErrors Remove-Job -Id $Job.Id } } foreach ($Job in @(Get-Job)) { $jobResult = Wait-Job -Id $Job.Id | Receive-Job CheckJobResult $jobResult.result $jobResult.packagePath ([ref]$ValidationFailures) Remove-Job -Id $Job.Id } if ($ValidationFailures -gt 0) { Write-PipelineTelemetryError -Category 'SourceLink' -Message "$ValidationFailures package(s) failed validation." ExitWithExitCode 1 } } function InstallSourcelinkCli { $sourcelinkCliPackageName = 'sourcelink' $dotnetRoot = InitializeDotNetCli -install:$true $dotnet = "$dotnetRoot\dotnet.exe" $toolList = & "$dotnet" tool list --global if (($toolList -like "*$sourcelinkCliPackageName*") -and ($toolList -like "*$sourcelinkCliVersion*")) { Write-Host "SourceLink CLI version $sourcelinkCliVersion is already installed." } else { Write-Host "Installing SourceLink CLI version $sourcelinkCliVersion..." Write-Host 'You may need to restart your command window if this is the first dotnet tool you have installed.' & "$dotnet" tool install $sourcelinkCliPackageName --version $sourcelinkCliVersion --verbosity "minimal" --global } } try { InstallSourcelinkCli foreach ($Job in @(Get-Job)) { Remove-Job -Id $Job.Id } ValidateSourceLinkLinks } catch { Write-Host $_.Exception Write-Host $_.ScriptStackTrace Write-PipelineTelemetryError -Category 'SourceLink' -Message $_ ExitWithExitCode 1 }
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/libraries/Common/src/Interop/Windows/Advapi32/Interop.NotifyChangeEventLog.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Runtime.InteropServices; using Microsoft.Win32.SafeHandles; internal static partial class Interop { internal static partial class Advapi32 { [GeneratedDllImport(Libraries.Advapi32, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static partial bool NotifyChangeEventLog(SafeEventLogReadHandle hEventLog, SafeWaitHandle hEvent); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Runtime.InteropServices; using Microsoft.Win32.SafeHandles; internal static partial class Interop { internal static partial class Advapi32 { [GeneratedDllImport(Libraries.Advapi32, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static partial bool NotifyChangeEventLog(SafeEventLogReadHandle hEventLog, SafeWaitHandle hEvent); } }
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/tests/JIT/HardwareIntrinsics/X86/Sse1/StoreAlignedNonTemporal.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics.X86; using System.Runtime.Intrinsics; namespace IntelHardwareIntrinsicTest { class Program { const int Pass = 100; const int Fail = 0; static unsafe int Main(string[] args) { int testResult = Pass; if (Sse.IsSupported) { float* inArray = stackalloc float[4]; byte* outBuffer = stackalloc byte[32]; float* outArray = Align(outBuffer, 16); var vf = Unsafe.Read<Vector128<float>>(inArray); Sse.StoreAlignedNonTemporal(outArray, vf); for (var i = 0; i < 4; i++) { if (BitConverter.SingleToInt32Bits(inArray[i]) != BitConverter.SingleToInt32Bits(outArray[i])) { Console.WriteLine("SSE StoreAlignedNonTemporal failed on float:"); for (var n = 0; n < 4; n++) { Console.Write(outArray[n] + ", "); } Console.WriteLine(); testResult = Fail; break; } } } return testResult; } static unsafe float* Align(byte* buffer, byte expectedAlignment) { // Compute how bad the misalignment is, which is at most (expectedAlignment - 1). // Then subtract that from the expectedAlignment and add it to the original address // to compute the aligned address. var misalignment = expectedAlignment - ((ulong)(buffer) % expectedAlignment); return (float*)(buffer + misalignment); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics.X86; using System.Runtime.Intrinsics; namespace IntelHardwareIntrinsicTest { class Program { const int Pass = 100; const int Fail = 0; static unsafe int Main(string[] args) { int testResult = Pass; if (Sse.IsSupported) { float* inArray = stackalloc float[4]; byte* outBuffer = stackalloc byte[32]; float* outArray = Align(outBuffer, 16); var vf = Unsafe.Read<Vector128<float>>(inArray); Sse.StoreAlignedNonTemporal(outArray, vf); for (var i = 0; i < 4; i++) { if (BitConverter.SingleToInt32Bits(inArray[i]) != BitConverter.SingleToInt32Bits(outArray[i])) { Console.WriteLine("SSE StoreAlignedNonTemporal failed on float:"); for (var n = 0; n < 4; n++) { Console.Write(outArray[n] + ", "); } Console.WriteLine(); testResult = Fail; break; } } } return testResult; } static unsafe float* Align(byte* buffer, byte expectedAlignment) { // Compute how bad the misalignment is, which is at most (expectedAlignment - 1). // Then subtract that from the expectedAlignment and add it to the original address // to compute the aligned address. var misalignment = expectedAlignment - ((ulong)(buffer) % expectedAlignment); return (float*)(buffer + misalignment); } } }
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd/SubtractWideningUpper.Vector128.UInt32.Vector128.UInt32.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void SubtractWideningUpper_Vector128_UInt32_Vector128_UInt32() { var test = new SimpleBinaryOpTest__SubtractWideningUpper_Vector128_UInt32_Vector128_UInt32(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleBinaryOpTest__SubtractWideningUpper_Vector128_UInt32_Vector128_UInt32 { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle outHandle; private ulong alignment; public DataTable(UInt32[] inArray1, UInt32[] inArray2, UInt64[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<UInt32>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<UInt32>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt64>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<UInt32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<UInt32, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<UInt32> _fld1; public Vector128<UInt32> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref testStruct._fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref testStruct._fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__SubtractWideningUpper_Vector128_UInt32_Vector128_UInt32 testClass) { var result = AdvSimd.SubtractWideningUpper(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__SubtractWideningUpper_Vector128_UInt32_Vector128_UInt32 testClass) { fixed (Vector128<UInt32>* pFld1 = &_fld1) fixed (Vector128<UInt32>* pFld2 = &_fld2) { var result = AdvSimd.SubtractWideningUpper( AdvSimd.LoadVector128((UInt32*)(pFld1)), AdvSimd.LoadVector128((UInt32*)(pFld2)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64); private static UInt32[] _data1 = new UInt32[Op1ElementCount]; private static UInt32[] _data2 = new UInt32[Op2ElementCount]; private static Vector128<UInt32> _clsVar1; private static Vector128<UInt32> _clsVar2; private Vector128<UInt32> _fld1; private Vector128<UInt32> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__SubtractWideningUpper_Vector128_UInt32_Vector128_UInt32() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); } public SimpleBinaryOpTest__SubtractWideningUpper_Vector128_UInt32_Vector128_UInt32() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } _dataTable = new DataTable(_data1, _data2, new UInt64[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.SubtractWideningUpper( Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray2Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.SubtractWideningUpper( AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray2Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.SubtractWideningUpper), new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt32>) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt64>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.SubtractWideningUpper), new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt32>) }) .Invoke(null, new object[] { AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt64>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.SubtractWideningUpper( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector128<UInt32>* pClsVar1 = &_clsVar1) fixed (Vector128<UInt32>* pClsVar2 = &_clsVar2) { var result = AdvSimd.SubtractWideningUpper( AdvSimd.LoadVector128((UInt32*)(pClsVar1)), AdvSimd.LoadVector128((UInt32*)(pClsVar2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray2Ptr); var result = AdvSimd.SubtractWideningUpper(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)); var op2 = AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray2Ptr)); var result = AdvSimd.SubtractWideningUpper(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__SubtractWideningUpper_Vector128_UInt32_Vector128_UInt32(); var result = AdvSimd.SubtractWideningUpper(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleBinaryOpTest__SubtractWideningUpper_Vector128_UInt32_Vector128_UInt32(); fixed (Vector128<UInt32>* pFld1 = &test._fld1) fixed (Vector128<UInt32>* pFld2 = &test._fld2) { var result = AdvSimd.SubtractWideningUpper( AdvSimd.LoadVector128((UInt32*)(pFld1)), AdvSimd.LoadVector128((UInt32*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.SubtractWideningUpper(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector128<UInt32>* pFld1 = &_fld1) fixed (Vector128<UInt32>* pFld2 = &_fld2) { var result = AdvSimd.SubtractWideningUpper( AdvSimd.LoadVector128((UInt32*)(pFld1)), AdvSimd.LoadVector128((UInt32*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.SubtractWideningUpper(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.SubtractWideningUpper( AdvSimd.LoadVector128((UInt32*)(&test._fld1)), AdvSimd.LoadVector128((UInt32*)(&test._fld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector128<UInt32> op1, Vector128<UInt32> op2, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] inArray2 = new UInt32[Op2ElementCount]; UInt64[] outArray = new UInt64[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] inArray2 = new UInt32[Op2ElementCount]; UInt64[] outArray = new UInt64[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(UInt32[] left, UInt32[] right, UInt64[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.SubtractWideningUpper(left, right, i) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.SubtractWideningUpper)}<UInt64>(Vector128<UInt32>, Vector128<UInt32>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void SubtractWideningUpper_Vector128_UInt32_Vector128_UInt32() { var test = new SimpleBinaryOpTest__SubtractWideningUpper_Vector128_UInt32_Vector128_UInt32(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleBinaryOpTest__SubtractWideningUpper_Vector128_UInt32_Vector128_UInt32 { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle outHandle; private ulong alignment; public DataTable(UInt32[] inArray1, UInt32[] inArray2, UInt64[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<UInt32>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<UInt32>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt64>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<UInt32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<UInt32, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<UInt32> _fld1; public Vector128<UInt32> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref testStruct._fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref testStruct._fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__SubtractWideningUpper_Vector128_UInt32_Vector128_UInt32 testClass) { var result = AdvSimd.SubtractWideningUpper(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__SubtractWideningUpper_Vector128_UInt32_Vector128_UInt32 testClass) { fixed (Vector128<UInt32>* pFld1 = &_fld1) fixed (Vector128<UInt32>* pFld2 = &_fld2) { var result = AdvSimd.SubtractWideningUpper( AdvSimd.LoadVector128((UInt32*)(pFld1)), AdvSimd.LoadVector128((UInt32*)(pFld2)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64); private static UInt32[] _data1 = new UInt32[Op1ElementCount]; private static UInt32[] _data2 = new UInt32[Op2ElementCount]; private static Vector128<UInt32> _clsVar1; private static Vector128<UInt32> _clsVar2; private Vector128<UInt32> _fld1; private Vector128<UInt32> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__SubtractWideningUpper_Vector128_UInt32_Vector128_UInt32() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); } public SimpleBinaryOpTest__SubtractWideningUpper_Vector128_UInt32_Vector128_UInt32() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } _dataTable = new DataTable(_data1, _data2, new UInt64[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.SubtractWideningUpper( Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray2Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.SubtractWideningUpper( AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray2Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.SubtractWideningUpper), new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt32>) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt64>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.SubtractWideningUpper), new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt32>) }) .Invoke(null, new object[] { AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt64>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.SubtractWideningUpper( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector128<UInt32>* pClsVar1 = &_clsVar1) fixed (Vector128<UInt32>* pClsVar2 = &_clsVar2) { var result = AdvSimd.SubtractWideningUpper( AdvSimd.LoadVector128((UInt32*)(pClsVar1)), AdvSimd.LoadVector128((UInt32*)(pClsVar2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray2Ptr); var result = AdvSimd.SubtractWideningUpper(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)); var op2 = AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray2Ptr)); var result = AdvSimd.SubtractWideningUpper(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__SubtractWideningUpper_Vector128_UInt32_Vector128_UInt32(); var result = AdvSimd.SubtractWideningUpper(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleBinaryOpTest__SubtractWideningUpper_Vector128_UInt32_Vector128_UInt32(); fixed (Vector128<UInt32>* pFld1 = &test._fld1) fixed (Vector128<UInt32>* pFld2 = &test._fld2) { var result = AdvSimd.SubtractWideningUpper( AdvSimd.LoadVector128((UInt32*)(pFld1)), AdvSimd.LoadVector128((UInt32*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.SubtractWideningUpper(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector128<UInt32>* pFld1 = &_fld1) fixed (Vector128<UInt32>* pFld2 = &_fld2) { var result = AdvSimd.SubtractWideningUpper( AdvSimd.LoadVector128((UInt32*)(pFld1)), AdvSimd.LoadVector128((UInt32*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.SubtractWideningUpper(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.SubtractWideningUpper( AdvSimd.LoadVector128((UInt32*)(&test._fld1)), AdvSimd.LoadVector128((UInt32*)(&test._fld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector128<UInt32> op1, Vector128<UInt32> op2, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] inArray2 = new UInt32[Op2ElementCount]; UInt64[] outArray = new UInt64[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] inArray2 = new UInt32[Op2ElementCount]; UInt64[] outArray = new UInt64[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(UInt32[] left, UInt32[] right, UInt64[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.SubtractWideningUpper(left, right, i) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.SubtractWideningUpper)}<UInt64>(Vector128<UInt32>, Vector128<UInt32>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/tests/JIT/opt/Devirtualization/comparable.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; public sealed class X: IComparable<X> { int ival; public X(int i) { ival = i; } public int CompareTo(X x) { return ival - x.ival; } public bool Equals(X x) { return ival == x.ival; } } public class Y<T> where T : IComparable<T> { public static int C(T x, T y) { // IL here is // ldarga 0 // ldarg 1 // constrained ... callvirt ... // // The ldarga blocks both caller-arg direct sub and type // propagation since the jit thinks arg0 might be redefined. // // For ref types the ldarga is undone in codegen just before // the call so we end up with *(&arg0) and we know this is // arg0. Ideally we'd also understand that this pattern can't // lead to reassignment, but our view of the callee and what // it does with address-taken args is quite limited. // // Even if we can't propagate the caller's value or type, we // might be able to retype the generic __Canon for arg0 as the // more specific type that the caller is using (here, X). // // An interesting variant on this would be to derive from X // (say with XD) and have the caller pass instances of XD // instead of instances of X. We'd need to make sure we retype // arg0 as X and not XD. return x.CompareTo(y); } } public class Z { public static int Main() { // Ideally inlining Y.C would enable the interface call in Y // to be devirtualized, since we know the exact type of the // first argument. We can't get this yet. int result = Y<X>.C(new X(103), new X(3)); return result; } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; public sealed class X: IComparable<X> { int ival; public X(int i) { ival = i; } public int CompareTo(X x) { return ival - x.ival; } public bool Equals(X x) { return ival == x.ival; } } public class Y<T> where T : IComparable<T> { public static int C(T x, T y) { // IL here is // ldarga 0 // ldarg 1 // constrained ... callvirt ... // // The ldarga blocks both caller-arg direct sub and type // propagation since the jit thinks arg0 might be redefined. // // For ref types the ldarga is undone in codegen just before // the call so we end up with *(&arg0) and we know this is // arg0. Ideally we'd also understand that this pattern can't // lead to reassignment, but our view of the callee and what // it does with address-taken args is quite limited. // // Even if we can't propagate the caller's value or type, we // might be able to retype the generic __Canon for arg0 as the // more specific type that the caller is using (here, X). // // An interesting variant on this would be to derive from X // (say with XD) and have the caller pass instances of XD // instead of instances of X. We'd need to make sure we retype // arg0 as X and not XD. return x.CompareTo(y); } } public class Z { public static int Main() { // Ideally inlining Y.C would enable the interface call in Y // to be devirtualized, since we know the exact type of the // first argument. We can't get this yet. int result = Y<X>.C(new X(103), new X(3)); return result; } }
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/tests/JIT/HardwareIntrinsics/X86/Sse2/CompareScalarNotLessThanOrEqual.Double.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.X86; namespace JIT.HardwareIntrinsics.X86 { public static partial class Program { private static void CompareScalarNotLessThanOrEqualDouble() { var test = new SimpleBinaryOpTest__CompareScalarNotLessThanOrEqualDouble(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (Sse2.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); // Validates basic functionality works, using LoadAligned test.RunBasicScenario_LoadAligned(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (Sse2.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); // Validates calling via reflection works, using LoadAligned test.RunReflectionScenario_LoadAligned(); } // Validates passing a static member works test.RunClsVarScenario(); if (Sse2.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (Sse2.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); // Validates passing a local works, using LoadAligned test.RunLclVarScenario_LoadAligned(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (Sse2.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (Sse2.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (Sse2.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (Sse2.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleBinaryOpTest__CompareScalarNotLessThanOrEqualDouble { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle outHandle; private ulong alignment; public DataTable(Double[] inArray1, Double[] inArray2, Double[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Double>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Double>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Double>(); if ((alignment != 32 && alignment != 16) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Double, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Double, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<Double> _fld1; public Vector128<Double> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref testStruct._fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref testStruct._fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__CompareScalarNotLessThanOrEqualDouble testClass) { var result = Sse2.CompareScalarNotLessThanOrEqual(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__CompareScalarNotLessThanOrEqualDouble testClass) { fixed (Vector128<Double>* pFld1 = &_fld1) fixed (Vector128<Double>* pFld2 = &_fld2) { var result = Sse2.CompareScalarNotLessThanOrEqual( Sse2.LoadVector128((Double*)(pFld1)), Sse2.LoadVector128((Double*)(pFld2)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double); private static Double[] _data1 = new Double[Op1ElementCount]; private static Double[] _data2 = new Double[Op2ElementCount]; private static Vector128<Double> _clsVar1; private static Vector128<Double> _clsVar2; private Vector128<Double> _fld1; private Vector128<Double> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__CompareScalarNotLessThanOrEqualDouble() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); } public SimpleBinaryOpTest__CompareScalarNotLessThanOrEqualDouble() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); } _dataTable = new DataTable(_data1, _data2, new Double[RetElementCount], LargestVectorSize); } public bool IsSupported => Sse2.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Sse2.CompareScalarNotLessThanOrEqual( Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Double>>(_dataTable.inArray2Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = Sse2.CompareScalarNotLessThanOrEqual( Sse2.LoadVector128((Double*)(_dataTable.inArray1Ptr)), Sse2.LoadVector128((Double*)(_dataTable.inArray2Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned)); var result = Sse2.CompareScalarNotLessThanOrEqual( Sse2.LoadAlignedVector128((Double*)(_dataTable.inArray1Ptr)), Sse2.LoadAlignedVector128((Double*)(_dataTable.inArray2Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(Sse2).GetMethod(nameof(Sse2.CompareScalarNotLessThanOrEqual), new Type[] { typeof(Vector128<Double>), typeof(Vector128<Double>) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Double>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Double>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(Sse2).GetMethod(nameof(Sse2.CompareScalarNotLessThanOrEqual), new Type[] { typeof(Vector128<Double>), typeof(Vector128<Double>) }) .Invoke(null, new object[] { Sse2.LoadVector128((Double*)(_dataTable.inArray1Ptr)), Sse2.LoadVector128((Double*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Double>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned)); var result = typeof(Sse2).GetMethod(nameof(Sse2.CompareScalarNotLessThanOrEqual), new Type[] { typeof(Vector128<Double>), typeof(Vector128<Double>) }) .Invoke(null, new object[] { Sse2.LoadAlignedVector128((Double*)(_dataTable.inArray1Ptr)), Sse2.LoadAlignedVector128((Double*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Double>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Sse2.CompareScalarNotLessThanOrEqual( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector128<Double>* pClsVar1 = &_clsVar1) fixed (Vector128<Double>* pClsVar2 = &_clsVar2) { var result = Sse2.CompareScalarNotLessThanOrEqual( Sse2.LoadVector128((Double*)(pClsVar1)), Sse2.LoadVector128((Double*)(pClsVar2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<Double>>(_dataTable.inArray2Ptr); var result = Sse2.CompareScalarNotLessThanOrEqual(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = Sse2.LoadVector128((Double*)(_dataTable.inArray1Ptr)); var op2 = Sse2.LoadVector128((Double*)(_dataTable.inArray2Ptr)); var result = Sse2.CompareScalarNotLessThanOrEqual(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned)); var op1 = Sse2.LoadAlignedVector128((Double*)(_dataTable.inArray1Ptr)); var op2 = Sse2.LoadAlignedVector128((Double*)(_dataTable.inArray2Ptr)); var result = Sse2.CompareScalarNotLessThanOrEqual(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__CompareScalarNotLessThanOrEqualDouble(); var result = Sse2.CompareScalarNotLessThanOrEqual(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleBinaryOpTest__CompareScalarNotLessThanOrEqualDouble(); fixed (Vector128<Double>* pFld1 = &test._fld1) fixed (Vector128<Double>* pFld2 = &test._fld2) { var result = Sse2.CompareScalarNotLessThanOrEqual( Sse2.LoadVector128((Double*)(pFld1)), Sse2.LoadVector128((Double*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Sse2.CompareScalarNotLessThanOrEqual(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector128<Double>* pFld1 = &_fld1) fixed (Vector128<Double>* pFld2 = &_fld2) { var result = Sse2.CompareScalarNotLessThanOrEqual( Sse2.LoadVector128((Double*)(pFld1)), Sse2.LoadVector128((Double*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Sse2.CompareScalarNotLessThanOrEqual(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = Sse2.CompareScalarNotLessThanOrEqual( Sse2.LoadVector128((Double*)(&test._fld1)), Sse2.LoadVector128((Double*)(&test._fld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector128<Double> op1, Vector128<Double> op2, void* result, [CallerMemberName] string method = "") { Double[] inArray1 = new Double[Op1ElementCount]; Double[] inArray2 = new Double[Op2ElementCount]; Double[] outArray = new Double[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { Double[] inArray1 = new Double[Op1ElementCount]; Double[] inArray2 = new Double[Op2ElementCount]; Double[] outArray = new Double[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<Double>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<Double>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(Double[] left, Double[] right, Double[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (BitConverter.DoubleToInt64Bits(result[0]) != (!(left[0] <= right[0]) ? -1 : 0)) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (BitConverter.DoubleToInt64Bits(left[i]) != BitConverter.DoubleToInt64Bits(result[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Sse2)}.{nameof(Sse2.CompareScalarNotLessThanOrEqual)}<Double>(Vector128<Double>, Vector128<Double>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.X86; namespace JIT.HardwareIntrinsics.X86 { public static partial class Program { private static void CompareScalarNotLessThanOrEqualDouble() { var test = new SimpleBinaryOpTest__CompareScalarNotLessThanOrEqualDouble(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (Sse2.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); // Validates basic functionality works, using LoadAligned test.RunBasicScenario_LoadAligned(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (Sse2.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); // Validates calling via reflection works, using LoadAligned test.RunReflectionScenario_LoadAligned(); } // Validates passing a static member works test.RunClsVarScenario(); if (Sse2.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (Sse2.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); // Validates passing a local works, using LoadAligned test.RunLclVarScenario_LoadAligned(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (Sse2.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (Sse2.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (Sse2.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (Sse2.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleBinaryOpTest__CompareScalarNotLessThanOrEqualDouble { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle outHandle; private ulong alignment; public DataTable(Double[] inArray1, Double[] inArray2, Double[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Double>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Double>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Double>(); if ((alignment != 32 && alignment != 16) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Double, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Double, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<Double> _fld1; public Vector128<Double> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref testStruct._fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref testStruct._fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__CompareScalarNotLessThanOrEqualDouble testClass) { var result = Sse2.CompareScalarNotLessThanOrEqual(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__CompareScalarNotLessThanOrEqualDouble testClass) { fixed (Vector128<Double>* pFld1 = &_fld1) fixed (Vector128<Double>* pFld2 = &_fld2) { var result = Sse2.CompareScalarNotLessThanOrEqual( Sse2.LoadVector128((Double*)(pFld1)), Sse2.LoadVector128((Double*)(pFld2)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double); private static Double[] _data1 = new Double[Op1ElementCount]; private static Double[] _data2 = new Double[Op2ElementCount]; private static Vector128<Double> _clsVar1; private static Vector128<Double> _clsVar2; private Vector128<Double> _fld1; private Vector128<Double> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__CompareScalarNotLessThanOrEqualDouble() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); } public SimpleBinaryOpTest__CompareScalarNotLessThanOrEqualDouble() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); } _dataTable = new DataTable(_data1, _data2, new Double[RetElementCount], LargestVectorSize); } public bool IsSupported => Sse2.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Sse2.CompareScalarNotLessThanOrEqual( Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Double>>(_dataTable.inArray2Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = Sse2.CompareScalarNotLessThanOrEqual( Sse2.LoadVector128((Double*)(_dataTable.inArray1Ptr)), Sse2.LoadVector128((Double*)(_dataTable.inArray2Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned)); var result = Sse2.CompareScalarNotLessThanOrEqual( Sse2.LoadAlignedVector128((Double*)(_dataTable.inArray1Ptr)), Sse2.LoadAlignedVector128((Double*)(_dataTable.inArray2Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(Sse2).GetMethod(nameof(Sse2.CompareScalarNotLessThanOrEqual), new Type[] { typeof(Vector128<Double>), typeof(Vector128<Double>) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Double>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Double>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(Sse2).GetMethod(nameof(Sse2.CompareScalarNotLessThanOrEqual), new Type[] { typeof(Vector128<Double>), typeof(Vector128<Double>) }) .Invoke(null, new object[] { Sse2.LoadVector128((Double*)(_dataTable.inArray1Ptr)), Sse2.LoadVector128((Double*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Double>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned)); var result = typeof(Sse2).GetMethod(nameof(Sse2.CompareScalarNotLessThanOrEqual), new Type[] { typeof(Vector128<Double>), typeof(Vector128<Double>) }) .Invoke(null, new object[] { Sse2.LoadAlignedVector128((Double*)(_dataTable.inArray1Ptr)), Sse2.LoadAlignedVector128((Double*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Double>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Sse2.CompareScalarNotLessThanOrEqual( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector128<Double>* pClsVar1 = &_clsVar1) fixed (Vector128<Double>* pClsVar2 = &_clsVar2) { var result = Sse2.CompareScalarNotLessThanOrEqual( Sse2.LoadVector128((Double*)(pClsVar1)), Sse2.LoadVector128((Double*)(pClsVar2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<Double>>(_dataTable.inArray2Ptr); var result = Sse2.CompareScalarNotLessThanOrEqual(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = Sse2.LoadVector128((Double*)(_dataTable.inArray1Ptr)); var op2 = Sse2.LoadVector128((Double*)(_dataTable.inArray2Ptr)); var result = Sse2.CompareScalarNotLessThanOrEqual(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned)); var op1 = Sse2.LoadAlignedVector128((Double*)(_dataTable.inArray1Ptr)); var op2 = Sse2.LoadAlignedVector128((Double*)(_dataTable.inArray2Ptr)); var result = Sse2.CompareScalarNotLessThanOrEqual(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__CompareScalarNotLessThanOrEqualDouble(); var result = Sse2.CompareScalarNotLessThanOrEqual(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleBinaryOpTest__CompareScalarNotLessThanOrEqualDouble(); fixed (Vector128<Double>* pFld1 = &test._fld1) fixed (Vector128<Double>* pFld2 = &test._fld2) { var result = Sse2.CompareScalarNotLessThanOrEqual( Sse2.LoadVector128((Double*)(pFld1)), Sse2.LoadVector128((Double*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Sse2.CompareScalarNotLessThanOrEqual(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector128<Double>* pFld1 = &_fld1) fixed (Vector128<Double>* pFld2 = &_fld2) { var result = Sse2.CompareScalarNotLessThanOrEqual( Sse2.LoadVector128((Double*)(pFld1)), Sse2.LoadVector128((Double*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Sse2.CompareScalarNotLessThanOrEqual(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = Sse2.CompareScalarNotLessThanOrEqual( Sse2.LoadVector128((Double*)(&test._fld1)), Sse2.LoadVector128((Double*)(&test._fld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector128<Double> op1, Vector128<Double> op2, void* result, [CallerMemberName] string method = "") { Double[] inArray1 = new Double[Op1ElementCount]; Double[] inArray2 = new Double[Op2ElementCount]; Double[] outArray = new Double[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { Double[] inArray1 = new Double[Op1ElementCount]; Double[] inArray2 = new Double[Op2ElementCount]; Double[] outArray = new Double[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<Double>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<Double>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(Double[] left, Double[] right, Double[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (BitConverter.DoubleToInt64Bits(result[0]) != (!(left[0] <= right[0]) ? -1 : 0)) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (BitConverter.DoubleToInt64Bits(left[i]) != BitConverter.DoubleToInt64Bits(result[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Sse2)}.{nameof(Sse2.CompareScalarNotLessThanOrEqual)}<Double>(Vector128<Double>, Vector128<Double>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/coreclr/tools/Common/TypeSystem/IL/MethodIL.Symbols.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Collections.Generic; using Internal.TypeSystem; namespace Internal.IL { partial class MethodIL { public virtual MethodDebugInformation GetDebugInfo() { return MethodDebugInformation.None; } } partial class InstantiatedMethodIL { public override MethodDebugInformation GetDebugInfo() { return _methodIL.GetDebugInfo(); } } /// <summary> /// Represents debug information attached to a <see cref="MethodIL"/>. /// </summary> public class MethodDebugInformation { public static MethodDebugInformation None = new MethodDebugInformation(); public virtual bool IsStateMachineMoveNextMethod => false; public virtual IEnumerable<ILSequencePoint> GetSequencePoints() { return Array.Empty<ILSequencePoint>(); } public virtual IEnumerable<ILLocalVariable> GetLocalVariables() { return Array.Empty<ILLocalVariable>(); } public virtual IEnumerable<string> GetParameterNames() { return Array.Empty<string>(); } } /// <summary> /// Represents a sequence point within an IL method body. /// Sequence point describes a point in the method body at which all side effects of /// previous evaluations have been performed. /// </summary> public struct ILSequencePoint { public readonly int Offset; public readonly string Document; public readonly int LineNumber; // TODO: The remaining info public ILSequencePoint(int offset, string document, int lineNumber) { Offset = offset; Document = document; LineNumber = lineNumber; } } /// <summary> /// Represents information about a local variable within a method body. /// </summary> public struct ILLocalVariable { public readonly int Slot; public readonly string Name; public readonly bool CompilerGenerated; public ILLocalVariable(int slot, string name, bool compilerGenerated) { Slot = slot; Name = name; CompilerGenerated = compilerGenerated; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Collections.Generic; using Internal.TypeSystem; namespace Internal.IL { partial class MethodIL { public virtual MethodDebugInformation GetDebugInfo() { return MethodDebugInformation.None; } } partial class InstantiatedMethodIL { public override MethodDebugInformation GetDebugInfo() { return _methodIL.GetDebugInfo(); } } /// <summary> /// Represents debug information attached to a <see cref="MethodIL"/>. /// </summary> public class MethodDebugInformation { public static MethodDebugInformation None = new MethodDebugInformation(); public virtual bool IsStateMachineMoveNextMethod => false; public virtual IEnumerable<ILSequencePoint> GetSequencePoints() { return Array.Empty<ILSequencePoint>(); } public virtual IEnumerable<ILLocalVariable> GetLocalVariables() { return Array.Empty<ILLocalVariable>(); } public virtual IEnumerable<string> GetParameterNames() { return Array.Empty<string>(); } } /// <summary> /// Represents a sequence point within an IL method body. /// Sequence point describes a point in the method body at which all side effects of /// previous evaluations have been performed. /// </summary> public struct ILSequencePoint { public readonly int Offset; public readonly string Document; public readonly int LineNumber; // TODO: The remaining info public ILSequencePoint(int offset, string document, int lineNumber) { Offset = offset; Document = document; LineNumber = lineNumber; } } /// <summary> /// Represents information about a local variable within a method body. /// </summary> public struct ILLocalVariable { public readonly int Slot; public readonly string Name; public readonly bool CompilerGenerated; public ILLocalVariable(int slot, string name, bool compilerGenerated) { Slot = slot; Name = name; CompilerGenerated = compilerGenerated; } } }
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/tests/JIT/jit64/mcc/interop/mcc_i36.ilproj
<Project Sdk="Microsoft.NET.Sdk.IL"> <PropertyGroup> <OutputType>Exe</OutputType> <!-- Test unsupported outside of windows --> <CLRTestTargetUnsupported Condition="'$(TargetsWindows)' != 'true'">true</CLRTestTargetUnsupported> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="mcc_i36.il ..\common\common.il" /> </ItemGroup> <ItemGroup> <ProjectReference Include="CMakeLists.txt" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk.IL"> <PropertyGroup> <OutputType>Exe</OutputType> <!-- Test unsupported outside of windows --> <CLRTestTargetUnsupported Condition="'$(TargetsWindows)' != 'true'">true</CLRTestTargetUnsupported> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="mcc_i36.il ..\common\common.il" /> </ItemGroup> <ItemGroup> <ProjectReference Include="CMakeLists.txt" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/tests/JIT/Regression/JitBlue/Runtime_60035/Runtime_60035.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Text; using System.Text.Encodings.Web; namespace Runtime_60035 { class Program { static int Main(string[] args) { byte[] inputBytes = Encoding.UTF8.GetBytes("https://github.com/dotnet/runtime"); Console.WriteLine(UrlEncoder.Default.FindFirstCharacterToEncodeUtf8(inputBytes)); return 100; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Text; using System.Text.Encodings.Web; namespace Runtime_60035 { class Program { static int Main(string[] args) { byte[] inputBytes = Encoding.UTF8.GetBytes("https://github.com/dotnet/runtime"); Console.WriteLine(UrlEncoder.Default.FindFirstCharacterToEncodeUtf8(inputBytes)); return 100; } } }
-1
dotnet/runtime
66,046
Fix handling of atomic nodes in RegexCompiler / source generator
We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
stephentoub
2022-03-02T01:17:05Z
2022-03-03T16:24:40Z
fdbdb9a81d2974b38c4c6c3dea9c3d2bf1d4b7d8
b410984a6287b722b7bd215441504fe78ecb2ca0
Fix handling of atomic nodes in RegexCompiler / source generator. We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.
./src/libraries/Common/src/Interop/Unix/System.Native/Interop.SendMessage.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Net.Sockets; using System.Runtime.InteropServices; internal static partial class Interop { internal static partial class Sys { [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SendMessage")] internal static unsafe partial Error SendMessage(SafeHandle socket, MessageHeader* messageHeader, SocketFlags flags, long* sent); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Net.Sockets; using System.Runtime.InteropServices; internal static partial class Interop { internal static partial class Sys { [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SendMessage")] internal static unsafe partial Error SendMessage(SafeHandle socket, MessageHeader* messageHeader, SocketFlags flags, long* sent); } }
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./eng/testing/tests.wasm.targets
<Project> <!-- We need to set this in order to get extensibility on xunit category traits and other arguments we pass down to xunit via MSBuild properties --> <PropertyGroup> <IsWasmProject Condition="'$(IsWasmProject)' == ''">true</IsWasmProject> <WasmGenerateAppBundle Condition="'$(WasmGenerateAppBundle)' == ''">true</WasmGenerateAppBundle> <BundleTestAppTargets>$(BundleTestAppTargets);BundleTestWasmApp</BundleTestAppTargets> <DebuggerSupport Condition="'$(DebuggerSupport)' == '' and '$(Configuration)' == 'Debug'">true</DebuggerSupport> <WasmNativeStrip Condition="'$(WasmNativeStrip)' == ''">false</WasmNativeStrip> <!-- Some tests expect to load satellite assemblies by path, eg. System.Runtime.Loader.Tests, so, just setting it true by default --> <IncludeSatelliteAssembliesInVFS Condition="'$(IncludeSatelliteAssembliesInVFS)' == ''">true</IncludeSatelliteAssembliesInVFS> <WasmEmitSymbolMap Condition="'$(WasmEmitSymbolMap)' == ''">true</WasmEmitSymbolMap> <!-- Run only if previous command succeeded --> <_ShellCommandSeparator Condition="'$(OS)' == 'Windows_NT'">&amp;&amp;</_ShellCommandSeparator> <_ShellCommandSeparator Condition="'$(OS)' != 'Windows_NT'">&amp;&amp;</_ShellCommandSeparator> <_WasmMainJSFileName Condition="'$(WasmMainJSPath)' != ''">$([System.IO.Path]::GetFileName('$(WasmMainJSPath)'))</_WasmMainJSFileName> <_WasmStrictVersionMatch Condition="'$(ContinuousIntegrationBuild)' == 'true'">true</_WasmStrictVersionMatch> <XUnitUseRandomizedTestOrderer Condition="'$(XUnitUseRandomizedTestOrderer)' == '' and '$(IsTestProject)' == 'true'">true</XUnitUseRandomizedTestOrderer> </PropertyGroup> <PropertyGroup> <BuildAOTTestsOn Condition="'$(ContinuousIntegrationBuild)' == 'true' and '$(Scenario)' == 'BuildWasmApps'">helix</BuildAOTTestsOn> <BuildAOTTestsOn Condition="'$(BuildAOTTestsOnHelix)' == 'true'">helix</BuildAOTTestsOn> <BuildAOTTestsOn Condition="'$(BuildAOTTestsOn)' == ''">local</BuildAOTTestsOn> </PropertyGroup> <ItemGroup> <_AOT_InternalForceInterpretAssemblies Include="@(HighAotMemoryUsageAssembly)" /> </ItemGroup> <!-- This is running during compile time and therefore $(Scenario) is empty, unless the specific project sets it. Any settings in the project file could be replaced on Helix. See also eng\testing\WasmRunnerTemplate.sh --> <ItemGroup Condition="'$(OS)' != 'Windows_NT'"> <SetScriptCommands Condition="'$(Scenario)' != '' and '$(ContinuousIntegrationBuild)' != 'true'" Include="export SCENARIO=$(Scenario)" /> <SetScriptCommands Condition="'$(JSEngine)' != ''" Include="export JS_ENGINE=--engine=$(JSEngine)" /> <SetScriptCommands Condition="'$(JSEngineArgs)' != ''" Include="export JS_ENGINE_ARGS=$(JSEngineArgs)" /> <SetScriptCommands Condition="'$(_WasmMainJSFileName)' != ''" Include="export MAIN_JS=--js-file=$(_WasmMainJSFileName)" /> </ItemGroup> <ItemGroup Condition="'$(OS)' == 'Windows_NT'"> <SetScriptCommands Condition="'$(Scenario)' != '' and '$(ContinuousIntegrationBuild)' != 'true'" Include="set &quot;SCENARIO=$(Scenario)&quot;" /> <SetScriptCommands Condition="'$(JSEngine)' != ''" Include="set &quot;JS_ENGINE=--engine^=$(JSEngine)&quot;" /> <SetScriptCommands Condition="'$(JSEngineArgs)' != ''" Include="set &quot;JS_ENGINE_ARGS=$(JSEngineArgs)&quot;" /> <SetScriptCommands Condition="'$(_WasmMainJSFileName)' != ''" Include="set &quot;MAIN_JS=--js-file^=$(_WasmMainJSFileName)&quot;" /> </ItemGroup> <PropertyGroup Condition="'$(RunScriptCommand)' == ''"> <_XHarnessArgs Condition="'$(OS)' != 'Windows_NT'">wasm $XHARNESS_COMMAND --app=. --output-directory=$XHARNESS_OUT</_XHarnessArgs> <_XHarnessArgs Condition="'$(OS)' == 'Windows_NT'">wasm %XHARNESS_COMMAND% --app=. --output-directory=%XHARNESS_OUT%</_XHarnessArgs> <_XHarnessArgs Condition="'$(IsFunctionalTest)' == 'true'" >$(_XHarnessArgs) --expected-exit-code=$(ExpectedExitCode)</_XHarnessArgs> <_XHarnessArgs Condition="'$(WasmXHarnessArgs)' != ''" >$(_XHarnessArgs) $(WasmXHarnessArgs)</_XHarnessArgs> <_XHarnessArgs >$(_XHarnessArgs) -s dotnet.js.symbols</_XHarnessArgs> <_XHarnessArgs Condition="'$(WasmXHarnessArgsCli)' != ''" >$(_XHarnessArgs) $(WasmXHarnessArgsCli)</_XHarnessArgs> <_AppArgs Condition="'$(IsFunctionalTest)' != 'true' and '$(Scenario)' != 'BuildWasmApps' and '$(WasmMainAssemblyFileName)' == ''">--run WasmTestRunner.dll $(AssemblyName).dll</_AppArgs> <_AppArgs Condition="'$(IsFunctionalTest)' != 'true' and '$(WasmMainAssemblyFileName)' != ''">--run $(WasmMainAssemblyFileName)</_AppArgs> <_AppArgs Condition="'$(IsFunctionalTest)' == 'true'">--run $(AssemblyName).dll</_AppArgs> <_AppArgs Condition="'$(WasmTestAppArgs)' != ''">$(_AppArgs) $(WasmTestAppArgs)</_AppArgs> <WasmXHarnessMonoArgs Condition="'$(XunitShowProgress)' == 'true'">$(WasmXHarnessMonoArgs) --setenv=XHARNESS_LOG_TEST_START=1</WasmXHarnessMonoArgs> <!-- There two flavors of WasmXHarnessArgs and WasmXHarnessMonoArgs, one is MSBuild property and the other is environment variable --> <RunScriptCommand Condition="'$(OS)' != 'Windows_NT'">$HARNESS_RUNNER $(_XHarnessArgs) %24XHARNESS_ARGS %24WasmXHarnessArgs -- $(WasmXHarnessMonoArgs) %24WasmXHarnessMonoArgs $(_AppArgs) %24WasmTestAppArgs</RunScriptCommand> <RunScriptCommand Condition="'$(OS)' == 'Windows_NT'">%HARNESS_RUNNER% $(_XHarnessArgs) %XHARNESS_ARGS% %WasmXHarnessArgs% -- $(WasmXHarnessMonoArgs) %WasmXHarnessMonoArgs% $(_AppArgs) %WasmTestAppArgs%</RunScriptCommand> </PropertyGroup> <PropertyGroup Condition="'$(BuildAOTTestsOnHelix)' == 'true'"> <_AOTBuildCommand Condition="'$(BrowserHost)' != 'windows'">_buildAOTFunc publish/ProxyProjectForAOTOnHelix.proj $XHARNESS_OUT/AOTBuild.binlog</_AOTBuildCommand> <_AOTBuildCommand Condition="'$(BrowserHost)' == 'windows'">dotnet msbuild publish/ProxyProjectForAOTOnHelix.proj /bl:%XHARNESS_OUT%/AOTBuild.binlog</_AOTBuildCommand> <_AOTBuildCommand Condition="'$(BrowserHost)' == 'windows'">$(_AOTBuildCommand) &quot;/p:WasmCachePath=%USERPROFILE%\.emscripten-cache&quot;</_AOTBuildCommand> <!-- running aot-helix tests locally, so we can test with the same project file as CI --> <_AOTBuildCommand Condition="'$(ContinuousIntegrationBuild)' != 'true'">$(_AOTBuildCommand) /p:RuntimeSrcDir=$(RepoRoot) /p:RuntimeConfig=$(Configuration)</_AOTBuildCommand> <_AOTBuildCommand>$(_AOTBuildCommand) /p:RunAOTCompilation=$(RunAOTCompilation)</_AOTBuildCommand> <_AOTBuildCommand>$(_AOTBuildCommand) $(_ShellCommandSeparator) cd wasm_build/AppBundle</_AOTBuildCommand> <RunScriptCommand Condition="'$(RunScriptCommand)' == ''">$(_AOTBuildCommand)</RunScriptCommand> <RunScriptCommand Condition="'$(RunScriptCommand)' != ''">$(_AOTBuildCommand) $(_ShellCommandSeparator) $(RunScriptCommand)</RunScriptCommand> </PropertyGroup> <!-- Don't include InTree.props here, because the test projects themselves can set the target* properties --> <Import Project="$(MonoProjectRoot)\wasm\build\WasmApp.props" Condition="'$(BuildAOTTestsOn)' == 'local'" /> <Import Project="$(MonoProjectRoot)\wasm\build\WasmApp.InTree.targets" Condition="'$(BuildAOTTestsOn)' == 'local'" /> <PropertyGroup> <BundleTestWasmAppDependsOn Condition="'$(BuildAOTTestsOn)' == 'local'">WasmTriggerPublishApp</BundleTestWasmAppDependsOn> <BundleTestWasmAppDependsOn Condition="'$(BuildAOTTestsOnHelix)' == 'true'">$(BundleTestWasmAppDependsOn);_BundleAOTTestWasmAppForHelix</BundleTestWasmAppDependsOn> </PropertyGroup> <PropertyGroup Condition="'$(BuildAOTTestsOnHelix)' == 'true'"> <!-- wasm targets are not imported at all, in this case, because we run the wasm build on helix --> </PropertyGroup> <PropertyGroup Condition="'$(BuildAOTTestsOnHelix)' != 'true'"> <WasmBuildOnlyAfterPublish>true</WasmBuildOnlyAfterPublish> <!-- wasm's publish targets will trigger publish, so we shouldn't do that --> <PublishTestAsSelfContainedDependsOn /> <WasmNestedPublishAppDependsOn>PrepareForWasmBuildApp;$(WasmNestedPublishAppDependsOn)</WasmNestedPublishAppDependsOn> </PropertyGroup> <ItemGroup> <WorkloadIdForTesting Include="wasm-tools" ManifestName="Microsoft.NET.Workload.Mono.ToolChain" Version="$(PackageVersion)" VersionBand="$(SdkBandVersion)" /> </ItemGroup> <Target Name="BundleTestWasmApp" DependsOnTargets="$(BundleTestWasmAppDependsOn)" /> <UsingTask Condition="'$(BuildAOTTestsOnHelix)' == 'true'" TaskName="Microsoft.WebAssembly.Build.Tasks.GenerateAOTProps" AssemblyFile="$(WasmBuildTasksAssemblyPath)" /> <Target Name="_BundleAOTTestWasmAppForHelix" DependsOnTargets="PrepareForWasmBuildApp"> <PropertyGroup Condition="'$(IsHighAotMemoryUsageTest)' == 'true' and '$(ContinuousIntegrationBuild)' == 'true'"> <DisableParallelEmccCompile Condition="'$(DisableParallelEmccCompile)' == ''">true</DisableParallelEmccCompile> <EmccLinkOptimizationFlag Condition="'$(EmccLinkOptimizationFlag)' == ''">-O2</EmccLinkOptimizationFlag> </PropertyGroup> <PropertyGroup> <_MainAssemblyPath Condition="'%(WasmAssembliesToBundle.FileName)' == $(AssemblyName) and '%(WasmAssembliesToBundle.Extension)' == '.dll'">%(WasmAssembliesToBundle.Identity)</_MainAssemblyPath> <RuntimeConfigFilePath>$([System.IO.Path]::ChangeExtension($(_MainAssemblyPath), '.runtimeconfig.json'))</RuntimeConfigFilePath> <EmccLinkOptimizationFlag Condition="'$(EmccLinkOptimizationFlag)' == ''">-Oz -Wl,-O0 -Wl,-lto-O0</EmccLinkOptimizationFlag> </PropertyGroup> <Error Text="Item WasmAssembliesToBundle is empty. This is likely an authoring error." Condition="@(WasmAssembliesToBundle->Count()) == 0" /> <ItemGroup> <BundleFiles Include="$(WasmMainJSPath)" TargetDir="publish" /> <BundleFiles Include="@(WasmAssembliesToBundle)" TargetDir="publish\%(WasmAssembliesToBundle.RecursiveDir)" /> <BundleFiles Include="$(RuntimeConfigFilePath)" TargetDir="publish" /> <BundleFiles Include="$(MonoProjectRoot)\wasm\data\aot-tests\*" TargetDir="publish" /> </ItemGroup> <ItemGroup Condition="'$(DebuggerSupport)' == 'true'"> <!-- Add any pdb files, if available --> <_BundlePdbFiles Include="$([System.IO.Path]::ChangeExtension('%(WasmAssembliesToBundle.Identity)', '.pdb'))" /> <BundleFiles Include="@(_BundlePdbFiles)" TargetDir="publish" Condition="Exists(%(_BundlePdbFiles.Identity))" /> </ItemGroup> <!-- To recreate the original project on helix, we need to set the wasm properties also, same as the library test project. Eg. $(InvariantGlobalization) --> <ItemGroup> <_WasmPropertyNames Include="AOTMode" /> <_WasmPropertyNames Include="AssemblyName" /> <_WasmPropertyNames Include="DisableParallelAot" /> <_WasmPropertyNames Include="DisableParallelEmccCompile" /> <_WasmPropertyNames Include="EmccCompileOptimizationFlag" /> <_WasmPropertyNames Include="EmccLinkOptimizationFlag" /> <_WasmPropertyNames Include="IncludeSatelliteAssembliesInVFS" /> <_WasmPropertyNames Include="InvariantGlobalization" /> <_WasmPropertyNames Include="WasmBuildNative" /> <_WasmPropertyNames Include="WasmDebugLevel" /> <_WasmPropertyNames Include="WasmDedup" /> <_WasmPropertyNames Include="WasmLinkIcalls" /> <_WasmPropertyNames Include="WasmNativeStrip" /> <_WasmPropertyNames Include="WasmEnableES6" /> <_WasmPropertyNames Include="_WasmDevel" /> <_WasmPropertyNames Include="_WasmStrictVersionMatch" /> <_WasmPropertyNames Include="WasmEmitSymbolMap" /> <_WasmPropertiesToPass Include="$(%(_WasmPropertyNames.Identity))" Name="%(_WasmPropertyNames.Identity)" ConditionToUse__="%(_WasmPropertyNames.ConditionToUse__)" /> <_WasmVFSFilesToCopy Include="@(WasmFilesToIncludeInFileSystem)" /> <_WasmVFSFilesToCopy TargetPath="%(FileName)%(Extension)" Condition="'%(_WasmVFSFilesToCopy.TargetPath)' == ''" /> <_WasmExtraFilesToCopy Include="@(WasmExtraFilesToDeploy)" /> <_WasmExtraFilesToCopy TargetPath="%(FileName)%(Extension)" Condition="'%(_WasmExtraFilesToCopy.TargetPath)' == ''" /> <!-- Example of passing items to the project <_WasmItemsToPass Include="@(BundleFiles)" OriginalItemName__="BundleFiles" ConditionToUse__="'$(Foo)' != 'true'" /> --> <_WasmItemsToPass Include="@(_AOT_InternalForceInterpretAssemblies)" OriginalItemName__="_AOT_InternalForceInterpretAssemblies" /> </ItemGroup> <!-- This file gets imported by the project file on helix --> <GenerateAOTProps Properties="@(_WasmPropertiesToPass)" Items="@(_WasmItemsToPass)" OutputFile="$(BundleDir)publish\ProxyProjectForAOTOnHelix.props" /> <Copy SourceFiles="@(BundleFiles)" DestinationFolder="$(BundleDir)%(TargetDir)" /> <Copy SourceFiles="@(_WasmVFSFilesToCopy)" DestinationFiles="$(BundleDir)\vfsFiles\%(_WasmVFSFilesToCopy.TargetPath)" /> <Copy SourceFiles="@(_WasmExtraFilesToCopy)" DestinationFiles="$(BundleDir)\extraFiles\%(_WasmExtraFilesToCopy.TargetPath)" /> </Target> <Target Name="PrepareForWasmBuildApp"> <PropertyGroup> <WasmAppDir>$(BundleDir)</WasmAppDir> <WasmMainAssemblyFileName Condition="'$(WasmMainAssemblyFileName)' == ''">WasmTestRunner.dll</WasmMainAssemblyFileName> <WasmMainJSPath Condition="'$(WasmMainJSPath)' == ''">$(MonoProjectRoot)\wasm\test-main.js</WasmMainJSPath> <WasmInvariantGlobalization>$(InvariantGlobalization)</WasmInvariantGlobalization> <WasmGenerateRunV8Script>true</WasmGenerateRunV8Script> <WasmNativeDebugSymbols Condition="'$(DebuggerSupport)' == 'true' and '$(WasmNativeDebugSymbols)' == ''">true</WasmNativeDebugSymbols> <WasmDebugLevel Condition="'$(DebuggerSupport)' == 'true' and '$(WasmDebugLevel)' == ''">-1</WasmDebugLevel> </PropertyGroup> <ItemGroup Condition="'$(IncludeSatelliteAssembliesInVFS)' == 'true' and '$(BuildAOTTestsOnHelix)' != 'true'"> <_SatelliteAssemblies Include="$(PublishDir)*\*.resources.dll" /> <_SatelliteAssemblies CultureName="$([System.IO.Directory]::GetParent('%(Identity)').Name)" /> <_SatelliteAssemblies TargetPath="%(CultureName)\%(FileName)%(Extension)" /> <WasmFilesToIncludeInFileSystem Include="@(_SatelliteAssemblies)" /> </ItemGroup> <ItemGroup> <WasmAssembliesToBundle Include="$(PublishDir)\**\*.dll" Condition="'$(BuildAOTTestsOnHelix)' == 'true'" /> <WasmFilesToIncludeInFileSystem Include="@(ContentWithTargetPath)" /> <_CopyLocalPaths Include="@(PublishItemsOutputGroupOutputs)" Condition="'%(PublishItemsOutputGroupOutputs.BuildReference)' == 'true' and !$([System.String]::new('%(PublishItemsOutputGroupOutputs.Identity)').EndsWith('.resources.dll'))" /> <_CopyLocalPaths TargetPath="%(_CopyLocalPaths.RelativePath)" Condition="'%(_CopyLocalPaths.RelativePath)' != ''" /> <_CopyLocalPaths TargetPath="%(FileName)%(Extension)" Condition="'%(_CopyLocalPaths.RelativePath)' == ''" /> <WasmFilesToIncludeInFileSystem Include="@(_CopyLocalPaths)" /> <!-- Include files specified by test projects from publish dir --> <WasmFilesToIncludeInFileSystem Include="$(PublishDir)%(WasmFilesToIncludeFromPublishDir.Identity)" TargetPath="%(WasmFilesToIncludeFromPublishDir.Identity)" Condition="'%(WasmFilesToIncludeFromPublishDir.Identity)' != ''" /> </ItemGroup> </Target> <!-- linker automatically picks up the .pdb files, but they are not added to the publish list. Add them explicitly here, so they can be used with WasmAppBuilder --> <Target Name="AddPdbFilesToPublishList" AfterTargets="ILLink" Condition="'$(DebuggerSupport)' == 'true'"> <ItemGroup> <_PdbFilesToCheck Include="$([System.IO.Path]::ChangeExtension('%(ResolvedFileToPublish.Identity)', '.pdb'))" Condition="'%(ResolvedFileToPublish.Extension)' == '.dll'" /> <ResolvedFileToPublish Include="@(_PdbFilesToCheck)" Condition="Exists(%(_PdbFilesToCheck.Identity))" RelativePath="%(_PdbFilesToCheck.FileName)%(_PdbFilesToCheck.Extension)" /> </ItemGroup> </Target> <Target Name="ProvideNodeNpmRestoreScripts" BeforeTargets="GenerateRunScript"> <!-- Combine optional alias on all NodeNpmModule and trim separator where alias is empty --> <ItemGroup> <_NodeNpmModuleString Include="%(NodeNpmModule.Identity):%(NodeNpmModule.Alias)" /> <_NodeNpmModuleStringTrimmed Include="@(_NodeNpmModuleString->Trim(':'))" /> </ItemGroup> <PropertyGroup> <NodeNpmModuleString>@(_NodeNpmModuleStringTrimmed, ',')</NodeNpmModuleString> </PropertyGroup> <!-- Restore NPM packages --> <ItemGroup Condition="'$(OS)' != 'Windows_NT'"> <SetScriptCommands Include="if [[ &quot;$SCENARIO&quot; == &quot;WasmTestOnNodeJs&quot; || &quot;$SCENARIO&quot; == &quot;wasmtestonnodejs&quot; ]]; then export WasmXHarnessMonoArgs=&quot;$WasmXHarnessMonoArgs --setenv=NPM_MODULES=$(NodeNpmModuleString)&quot;; fi" /> <RunScriptCommands Include="if [[ &quot;$SCENARIO&quot; == &quot;WasmTestOnNodeJs&quot; || &quot;$SCENARIO&quot; == &quot;wasmtestonnodejs&quot; ]]; then npm ci; fi" /> </ItemGroup> <ItemGroup Condition="'$(OS)' == 'Windows_NT'"> <SetScriptCommands Include="if /I [%SCENARIO%]==[WasmTestOnNodeJS] ( set &quot;WasmXHarnessMonoArgs=%WasmXHarnessMonoArgs% --setenv=NPM_MODULES^=$(NodeNpmModuleString)&quot; )" /> <RunScriptCommands Include="if /I [%SCENARIO%]==[WasmTestOnNodeJS] ( call npm ci )" /> </ItemGroup> </Target> </Project>
<Project> <!-- We need to set this in order to get extensibility on xunit category traits and other arguments we pass down to xunit via MSBuild properties --> <PropertyGroup> <IsWasmProject Condition="'$(IsWasmProject)' == ''">true</IsWasmProject> <WasmGenerateAppBundle Condition="'$(WasmGenerateAppBundle)' == ''">true</WasmGenerateAppBundle> <BundleTestAppTargets>$(BundleTestAppTargets);BundleTestWasmApp</BundleTestAppTargets> <DebuggerSupport Condition="'$(DebuggerSupport)' == '' and '$(Configuration)' == 'Debug'">true</DebuggerSupport> <!-- Some tests expect to load satellite assemblies by path, eg. System.Runtime.Loader.Tests, so, just setting it true by default --> <IncludeSatelliteAssembliesInVFS Condition="'$(IncludeSatelliteAssembliesInVFS)' == ''">true</IncludeSatelliteAssembliesInVFS> <!-- - For regular library tests, it will use the symbols file from the runtime pack. - for AOT library tests, we use WasmNativeStrip=false, so we already have symbols --> <WasmNativeStrip Condition="'$(WasmNativeStrip)' == ''">false</WasmNativeStrip> <WasmEmitSymbolMap Condition="'$(WasmEmitSymbolMap)' == '' and '$(RunAOTCompilation)' != 'true'">true</WasmEmitSymbolMap> <!-- Run only if previous command succeeded --> <_ShellCommandSeparator Condition="'$(OS)' == 'Windows_NT'">&amp;&amp;</_ShellCommandSeparator> <_ShellCommandSeparator Condition="'$(OS)' != 'Windows_NT'">&amp;&amp;</_ShellCommandSeparator> <_WasmMainJSFileName Condition="'$(WasmMainJSPath)' != ''">$([System.IO.Path]::GetFileName('$(WasmMainJSPath)'))</_WasmMainJSFileName> <_WasmStrictVersionMatch Condition="'$(ContinuousIntegrationBuild)' == 'true'">true</_WasmStrictVersionMatch> <XUnitUseRandomizedTestOrderer Condition="'$(XUnitUseRandomizedTestOrderer)' == '' and '$(IsTestProject)' == 'true'">true</XUnitUseRandomizedTestOrderer> </PropertyGroup> <PropertyGroup> <BuildAOTTestsOn Condition="'$(ContinuousIntegrationBuild)' == 'true' and '$(Scenario)' == 'BuildWasmApps'">helix</BuildAOTTestsOn> <BuildAOTTestsOn Condition="'$(BuildAOTTestsOnHelix)' == 'true'">helix</BuildAOTTestsOn> <BuildAOTTestsOn Condition="'$(BuildAOTTestsOn)' == ''">local</BuildAOTTestsOn> </PropertyGroup> <ItemGroup> <_AOT_InternalForceInterpretAssemblies Include="@(HighAotMemoryUsageAssembly)" /> </ItemGroup> <!-- This is running during compile time and therefore $(Scenario) is empty, unless the specific project sets it. Any settings in the project file could be replaced on Helix. See also eng\testing\WasmRunnerTemplate.sh --> <ItemGroup Condition="'$(OS)' != 'Windows_NT'"> <SetScriptCommands Condition="'$(Scenario)' != '' and '$(ContinuousIntegrationBuild)' != 'true'" Include="export SCENARIO=$(Scenario)" /> <SetScriptCommands Condition="'$(JSEngine)' != ''" Include="export JS_ENGINE=--engine=$(JSEngine)" /> <SetScriptCommands Condition="'$(JSEngineArgs)' != ''" Include="export JS_ENGINE_ARGS=$(JSEngineArgs)" /> <SetScriptCommands Condition="'$(_WasmMainJSFileName)' != ''" Include="export MAIN_JS=--js-file=$(_WasmMainJSFileName)" /> </ItemGroup> <ItemGroup Condition="'$(OS)' == 'Windows_NT'"> <SetScriptCommands Condition="'$(Scenario)' != '' and '$(ContinuousIntegrationBuild)' != 'true'" Include="set &quot;SCENARIO=$(Scenario)&quot;" /> <SetScriptCommands Condition="'$(JSEngine)' != ''" Include="set &quot;JS_ENGINE=--engine^=$(JSEngine)&quot;" /> <SetScriptCommands Condition="'$(JSEngineArgs)' != ''" Include="set &quot;JS_ENGINE_ARGS=$(JSEngineArgs)&quot;" /> <SetScriptCommands Condition="'$(_WasmMainJSFileName)' != ''" Include="set &quot;MAIN_JS=--js-file^=$(_WasmMainJSFileName)&quot;" /> </ItemGroup> <PropertyGroup Condition="'$(RunScriptCommand)' == ''"> <_XHarnessArgs Condition="'$(OS)' != 'Windows_NT'">wasm $XHARNESS_COMMAND --app=. --output-directory=$XHARNESS_OUT</_XHarnessArgs> <_XHarnessArgs Condition="'$(OS)' == 'Windows_NT'">wasm %XHARNESS_COMMAND% --app=. --output-directory=%XHARNESS_OUT%</_XHarnessArgs> <_XHarnessArgs Condition="'$(IsFunctionalTest)' == 'true'" >$(_XHarnessArgs) --expected-exit-code=$(ExpectedExitCode)</_XHarnessArgs> <_XHarnessArgs Condition="'$(WasmXHarnessArgs)' != ''" >$(_XHarnessArgs) $(WasmXHarnessArgs)</_XHarnessArgs> <_XHarnessArgs >$(_XHarnessArgs) -s dotnet.js.symbols</_XHarnessArgs> <_XHarnessArgs Condition="'$(WasmXHarnessArgsCli)' != ''" >$(_XHarnessArgs) $(WasmXHarnessArgsCli)</_XHarnessArgs> <_AppArgs Condition="'$(IsFunctionalTest)' != 'true' and '$(Scenario)' != 'BuildWasmApps' and '$(WasmMainAssemblyFileName)' == ''">--run WasmTestRunner.dll $(AssemblyName).dll</_AppArgs> <_AppArgs Condition="'$(IsFunctionalTest)' != 'true' and '$(WasmMainAssemblyFileName)' != ''">--run $(WasmMainAssemblyFileName)</_AppArgs> <_AppArgs Condition="'$(IsFunctionalTest)' == 'true'">--run $(AssemblyName).dll</_AppArgs> <_AppArgs Condition="'$(WasmTestAppArgs)' != ''">$(_AppArgs) $(WasmTestAppArgs)</_AppArgs> <WasmXHarnessMonoArgs Condition="'$(XunitShowProgress)' == 'true'">$(WasmXHarnessMonoArgs) --setenv=XHARNESS_LOG_TEST_START=1</WasmXHarnessMonoArgs> <!-- There two flavors of WasmXHarnessArgs and WasmXHarnessMonoArgs, one is MSBuild property and the other is environment variable --> <RunScriptCommand Condition="'$(OS)' != 'Windows_NT'">$HARNESS_RUNNER $(_XHarnessArgs) %24XHARNESS_ARGS %24WasmXHarnessArgs -- $(WasmXHarnessMonoArgs) %24WasmXHarnessMonoArgs $(_AppArgs) %24WasmTestAppArgs</RunScriptCommand> <RunScriptCommand Condition="'$(OS)' == 'Windows_NT'">%HARNESS_RUNNER% $(_XHarnessArgs) %XHARNESS_ARGS% %WasmXHarnessArgs% -- $(WasmXHarnessMonoArgs) %WasmXHarnessMonoArgs% $(_AppArgs) %WasmTestAppArgs%</RunScriptCommand> </PropertyGroup> <PropertyGroup Condition="'$(BuildAOTTestsOnHelix)' == 'true'"> <_AOTBuildCommand Condition="'$(BrowserHost)' != 'windows'">_buildAOTFunc publish/ProxyProjectForAOTOnHelix.proj $XHARNESS_OUT/AOTBuild.binlog</_AOTBuildCommand> <_AOTBuildCommand Condition="'$(BrowserHost)' == 'windows'">dotnet msbuild publish/ProxyProjectForAOTOnHelix.proj /bl:%XHARNESS_OUT%/AOTBuild.binlog</_AOTBuildCommand> <_AOTBuildCommand Condition="'$(BrowserHost)' == 'windows'">$(_AOTBuildCommand) &quot;/p:WasmCachePath=%USERPROFILE%\.emscripten-cache&quot;</_AOTBuildCommand> <!-- running aot-helix tests locally, so we can test with the same project file as CI --> <_AOTBuildCommand Condition="'$(ContinuousIntegrationBuild)' != 'true'">$(_AOTBuildCommand) /p:RuntimeSrcDir=$(RepoRoot) /p:RuntimeConfig=$(Configuration)</_AOTBuildCommand> <_AOTBuildCommand>$(_AOTBuildCommand) /p:RunAOTCompilation=$(RunAOTCompilation)</_AOTBuildCommand> <_AOTBuildCommand>$(_AOTBuildCommand) $(_ShellCommandSeparator) cd wasm_build/AppBundle</_AOTBuildCommand> <RunScriptCommand Condition="'$(RunScriptCommand)' == ''">$(_AOTBuildCommand)</RunScriptCommand> <RunScriptCommand Condition="'$(RunScriptCommand)' != ''">$(_AOTBuildCommand) $(_ShellCommandSeparator) $(RunScriptCommand)</RunScriptCommand> </PropertyGroup> <!-- Don't include InTree.props here, because the test projects themselves can set the target* properties --> <Import Project="$(MonoProjectRoot)\wasm\build\WasmApp.props" Condition="'$(BuildAOTTestsOn)' == 'local'" /> <Import Project="$(MonoProjectRoot)\wasm\build\WasmApp.InTree.targets" Condition="'$(BuildAOTTestsOn)' == 'local'" /> <PropertyGroup> <BundleTestWasmAppDependsOn Condition="'$(BuildAOTTestsOn)' == 'local'">WasmTriggerPublishApp</BundleTestWasmAppDependsOn> <BundleTestWasmAppDependsOn Condition="'$(BuildAOTTestsOnHelix)' == 'true'">$(BundleTestWasmAppDependsOn);_BundleAOTTestWasmAppForHelix</BundleTestWasmAppDependsOn> </PropertyGroup> <PropertyGroup Condition="'$(BuildAOTTestsOnHelix)' == 'true'"> <!-- wasm targets are not imported at all, in this case, because we run the wasm build on helix --> </PropertyGroup> <PropertyGroup Condition="'$(BuildAOTTestsOnHelix)' != 'true'"> <WasmBuildOnlyAfterPublish>true</WasmBuildOnlyAfterPublish> <!-- wasm's publish targets will trigger publish, so we shouldn't do that --> <PublishTestAsSelfContainedDependsOn /> <WasmNestedPublishAppDependsOn>PrepareForWasmBuildApp;$(WasmNestedPublishAppDependsOn)</WasmNestedPublishAppDependsOn> </PropertyGroup> <ItemGroup> <WorkloadIdForTesting Include="wasm-tools" ManifestName="Microsoft.NET.Workload.Mono.ToolChain" Version="$(PackageVersion)" VersionBand="$(SdkBandVersion)" /> </ItemGroup> <Target Name="BundleTestWasmApp" DependsOnTargets="$(BundleTestWasmAppDependsOn)" /> <UsingTask Condition="'$(BuildAOTTestsOnHelix)' == 'true'" TaskName="Microsoft.WebAssembly.Build.Tasks.GenerateAOTProps" AssemblyFile="$(WasmBuildTasksAssemblyPath)" /> <Target Name="_BundleAOTTestWasmAppForHelix" DependsOnTargets="PrepareForWasmBuildApp"> <PropertyGroup Condition="'$(IsHighAotMemoryUsageTest)' == 'true' and '$(ContinuousIntegrationBuild)' == 'true'"> <DisableParallelEmccCompile Condition="'$(DisableParallelEmccCompile)' == ''">true</DisableParallelEmccCompile> <EmccLinkOptimizationFlag Condition="'$(EmccLinkOptimizationFlag)' == ''">-O2</EmccLinkOptimizationFlag> </PropertyGroup> <PropertyGroup> <_MainAssemblyPath Condition="'%(WasmAssembliesToBundle.FileName)' == $(AssemblyName) and '%(WasmAssembliesToBundle.Extension)' == '.dll'">%(WasmAssembliesToBundle.Identity)</_MainAssemblyPath> <RuntimeConfigFilePath>$([System.IO.Path]::ChangeExtension($(_MainAssemblyPath), '.runtimeconfig.json'))</RuntimeConfigFilePath> <EmccLinkOptimizationFlag Condition="'$(EmccLinkOptimizationFlag)' == ''">-Oz -Wl,-O0 -Wl,-lto-O0</EmccLinkOptimizationFlag> </PropertyGroup> <Error Text="Item WasmAssembliesToBundle is empty. This is likely an authoring error." Condition="@(WasmAssembliesToBundle->Count()) == 0" /> <ItemGroup> <BundleFiles Include="$(WasmMainJSPath)" TargetDir="publish" /> <BundleFiles Include="@(WasmAssembliesToBundle)" TargetDir="publish\%(WasmAssembliesToBundle.RecursiveDir)" /> <BundleFiles Include="$(RuntimeConfigFilePath)" TargetDir="publish" /> <BundleFiles Include="$(MonoProjectRoot)\wasm\data\aot-tests\*" TargetDir="publish" /> </ItemGroup> <ItemGroup Condition="'$(DebuggerSupport)' == 'true'"> <!-- Add any pdb files, if available --> <_BundlePdbFiles Include="$([System.IO.Path]::ChangeExtension('%(WasmAssembliesToBundle.Identity)', '.pdb'))" /> <BundleFiles Include="@(_BundlePdbFiles)" TargetDir="publish" Condition="Exists(%(_BundlePdbFiles.Identity))" /> </ItemGroup> <!-- To recreate the original project on helix, we need to set the wasm properties also, same as the library test project. Eg. $(InvariantGlobalization) --> <ItemGroup> <_WasmPropertyNames Include="AOTMode" /> <_WasmPropertyNames Include="AssemblyName" /> <_WasmPropertyNames Include="DisableParallelAot" /> <_WasmPropertyNames Include="DisableParallelEmccCompile" /> <_WasmPropertyNames Include="EmccCompileOptimizationFlag" /> <_WasmPropertyNames Include="EmccLinkOptimizationFlag" /> <_WasmPropertyNames Include="IncludeSatelliteAssembliesInVFS" /> <_WasmPropertyNames Include="InvariantGlobalization" /> <_WasmPropertyNames Include="WasmBuildNative" /> <_WasmPropertyNames Include="WasmDebugLevel" /> <_WasmPropertyNames Include="WasmDedup" /> <_WasmPropertyNames Include="WasmLinkIcalls" /> <_WasmPropertyNames Include="WasmNativeStrip" /> <_WasmPropertyNames Include="WasmEnableES6" /> <_WasmPropertyNames Include="_WasmDevel" /> <_WasmPropertyNames Include="_WasmStrictVersionMatch" /> <_WasmPropertyNames Include="WasmEmitSymbolMap" /> <_WasmPropertiesToPass Include="$(%(_WasmPropertyNames.Identity))" Name="%(_WasmPropertyNames.Identity)" ConditionToUse__="%(_WasmPropertyNames.ConditionToUse__)" /> <_WasmVFSFilesToCopy Include="@(WasmFilesToIncludeInFileSystem)" /> <_WasmVFSFilesToCopy TargetPath="%(FileName)%(Extension)" Condition="'%(_WasmVFSFilesToCopy.TargetPath)' == ''" /> <_WasmExtraFilesToCopy Include="@(WasmExtraFilesToDeploy)" /> <_WasmExtraFilesToCopy TargetPath="%(FileName)%(Extension)" Condition="'%(_WasmExtraFilesToCopy.TargetPath)' == ''" /> <!-- Example of passing items to the project <_WasmItemsToPass Include="@(BundleFiles)" OriginalItemName__="BundleFiles" ConditionToUse__="'$(Foo)' != 'true'" /> --> <_WasmItemsToPass Include="@(_AOT_InternalForceInterpretAssemblies)" OriginalItemName__="_AOT_InternalForceInterpretAssemblies" /> </ItemGroup> <!-- This file gets imported by the project file on helix --> <GenerateAOTProps Properties="@(_WasmPropertiesToPass)" Items="@(_WasmItemsToPass)" OutputFile="$(BundleDir)publish\ProxyProjectForAOTOnHelix.props" /> <Copy SourceFiles="@(BundleFiles)" DestinationFolder="$(BundleDir)%(TargetDir)" /> <Copy SourceFiles="@(_WasmVFSFilesToCopy)" DestinationFiles="$(BundleDir)\vfsFiles\%(_WasmVFSFilesToCopy.TargetPath)" /> <Copy SourceFiles="@(_WasmExtraFilesToCopy)" DestinationFiles="$(BundleDir)\extraFiles\%(_WasmExtraFilesToCopy.TargetPath)" /> </Target> <Target Name="PrepareForWasmBuildApp"> <PropertyGroup> <WasmAppDir>$(BundleDir)</WasmAppDir> <WasmMainAssemblyFileName Condition="'$(WasmMainAssemblyFileName)' == ''">WasmTestRunner.dll</WasmMainAssemblyFileName> <WasmMainJSPath Condition="'$(WasmMainJSPath)' == ''">$(MonoProjectRoot)\wasm\test-main.js</WasmMainJSPath> <WasmInvariantGlobalization>$(InvariantGlobalization)</WasmInvariantGlobalization> <WasmGenerateRunV8Script>true</WasmGenerateRunV8Script> <WasmNativeDebugSymbols Condition="'$(DebuggerSupport)' == 'true' and '$(WasmNativeDebugSymbols)' == ''">true</WasmNativeDebugSymbols> <WasmDebugLevel Condition="'$(DebuggerSupport)' == 'true' and '$(WasmDebugLevel)' == ''">-1</WasmDebugLevel> </PropertyGroup> <ItemGroup Condition="'$(IncludeSatelliteAssembliesInVFS)' == 'true' and '$(BuildAOTTestsOnHelix)' != 'true'"> <_SatelliteAssemblies Include="$(PublishDir)*\*.resources.dll" /> <_SatelliteAssemblies CultureName="$([System.IO.Directory]::GetParent('%(Identity)').Name)" /> <_SatelliteAssemblies TargetPath="%(CultureName)\%(FileName)%(Extension)" /> <WasmFilesToIncludeInFileSystem Include="@(_SatelliteAssemblies)" /> </ItemGroup> <ItemGroup> <WasmAssembliesToBundle Include="$(PublishDir)\**\*.dll" Condition="'$(BuildAOTTestsOnHelix)' == 'true'" /> <WasmFilesToIncludeInFileSystem Include="@(ContentWithTargetPath)" /> <_CopyLocalPaths Include="@(PublishItemsOutputGroupOutputs)" Condition="'%(PublishItemsOutputGroupOutputs.BuildReference)' == 'true' and !$([System.String]::new('%(PublishItemsOutputGroupOutputs.Identity)').EndsWith('.resources.dll'))" /> <_CopyLocalPaths TargetPath="%(_CopyLocalPaths.RelativePath)" Condition="'%(_CopyLocalPaths.RelativePath)' != ''" /> <_CopyLocalPaths TargetPath="%(FileName)%(Extension)" Condition="'%(_CopyLocalPaths.RelativePath)' == ''" /> <WasmFilesToIncludeInFileSystem Include="@(_CopyLocalPaths)" /> <!-- Include files specified by test projects from publish dir --> <WasmFilesToIncludeInFileSystem Include="$(PublishDir)%(WasmFilesToIncludeFromPublishDir.Identity)" TargetPath="%(WasmFilesToIncludeFromPublishDir.Identity)" Condition="'%(WasmFilesToIncludeFromPublishDir.Identity)' != ''" /> </ItemGroup> </Target> <!-- linker automatically picks up the .pdb files, but they are not added to the publish list. Add them explicitly here, so they can be used with WasmAppBuilder --> <Target Name="AddPdbFilesToPublishList" AfterTargets="ILLink" Condition="'$(DebuggerSupport)' == 'true'"> <ItemGroup> <_PdbFilesToCheck Include="$([System.IO.Path]::ChangeExtension('%(ResolvedFileToPublish.Identity)', '.pdb'))" Condition="'%(ResolvedFileToPublish.Extension)' == '.dll'" /> <ResolvedFileToPublish Include="@(_PdbFilesToCheck)" Condition="Exists(%(_PdbFilesToCheck.Identity))" RelativePath="%(_PdbFilesToCheck.FileName)%(_PdbFilesToCheck.Extension)" /> </ItemGroup> </Target> <Target Name="ProvideNodeNpmRestoreScripts" BeforeTargets="GenerateRunScript"> <!-- Combine optional alias on all NodeNpmModule and trim separator where alias is empty --> <ItemGroup> <_NodeNpmModuleString Include="%(NodeNpmModule.Identity):%(NodeNpmModule.Alias)" /> <_NodeNpmModuleStringTrimmed Include="@(_NodeNpmModuleString->Trim(':'))" /> </ItemGroup> <PropertyGroup> <NodeNpmModuleString>@(_NodeNpmModuleStringTrimmed, ',')</NodeNpmModuleString> </PropertyGroup> <!-- Restore NPM packages --> <ItemGroup Condition="'$(OS)' != 'Windows_NT'"> <SetScriptCommands Include="if [[ &quot;$SCENARIO&quot; == &quot;WasmTestOnNodeJs&quot; || &quot;$SCENARIO&quot; == &quot;wasmtestonnodejs&quot; ]]; then export WasmXHarnessMonoArgs=&quot;$WasmXHarnessMonoArgs --setenv=NPM_MODULES=$(NodeNpmModuleString)&quot;; fi" /> <RunScriptCommands Include="if [[ &quot;$SCENARIO&quot; == &quot;WasmTestOnNodeJs&quot; || &quot;$SCENARIO&quot; == &quot;wasmtestonnodejs&quot; ]]; then npm ci; fi" /> </ItemGroup> <ItemGroup Condition="'$(OS)' == 'Windows_NT'"> <SetScriptCommands Include="if /I [%SCENARIO%]==[WasmTestOnNodeJS] ( set &quot;WasmXHarnessMonoArgs=%WasmXHarnessMonoArgs% --setenv=NPM_MODULES^=$(NodeNpmModuleString)&quot; )" /> <RunScriptCommands Include="if /I [%SCENARIO%]==[WasmTestOnNodeJS] ( call npm ci )" /> </ItemGroup> </Target> </Project>
1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/mono/sample/wasm/wasm.mk
DOTNET=$(TOP)/dotnet.sh ifeq ($(V),) DOTNET_Q_ARGS=--nologo -v:q -consoleloggerparameters:NoSummary -bl else DOTNET_Q_ARGS=--nologo -bl endif CONFIG?=Release WASM_DEFAULT_BUILD_ARGS?=/p:TargetArchitecture=wasm /p:TargetOS=Browser /p:Configuration=$(CONFIG) # if we're in a container, don't try to open the browser ifneq ("$(wildcard /.dockerenv)", "") OPEN_BROWSER= V8_PATH=v8 else OPEN_BROWSER=-o V8_PATH=~/.jsvu/v8 endif all: publish build: EMSDK_PATH=$(realpath $(TOP)/src/mono/wasm/emsdk) $(DOTNET) build $(DOTNET_Q_ARGS) $(WASM_DEFAULT_BUILD_ARGS) $(MSBUILD_ARGS) $(PROJECT_NAME) publish: EMSDK_PATH=$(realpath $(TOP)/src/mono/wasm/emsdk) $(DOTNET) publish $(DOTNET_Q_ARGS) $(WASM_DEFAULT_BUILD_ARGS) -p:WasmBuildOnlyAfterPublish=true $(MSBUILD_ARGS) $(PROJECT_NAME) clean: rm -rf bin $(TOP)/artifacts/obj/mono/$(PROJECT_NAME:%.csproj=%) run-browser: if ! $(DOTNET) tool list --global | grep dotnet-serve && ! which dotnet-serve ; then \ echo "The tool dotnet-serve could not be found. Install with: $(DOTNET) tool install --global dotnet-serve"; \ exit 1; \ else \ $(DOTNET) serve -d:bin/$(CONFIG)/AppBundle $(OPEN_BROWSER) -p:8000; \ fi run-console: cd bin/$(CONFIG)/AppBundle && $(V8_PATH) --stack-trace-limit=1000 --single-threaded --expose_wasm $(MAIN_JS) -- $(DOTNET_MONO_LOG_LEVEL) --run $(CONSOLE_DLL) $(ARGS) run-console-node: cd bin/$(CONFIG)/AppBundle && node --stack-trace-limit=1000 --single-threaded --expose_wasm $(MAIN_JS) -- $(DOTNET_MONO_LOG_LEVEL) --run $(CONSOLE_DLL) $(ARGS)
DOTNET=$(TOP)/dotnet.sh ifeq ($(V),) DOTNET_Q_ARGS=--nologo -v:q -consoleloggerparameters:NoSummary -bl else DOTNET_Q_ARGS=--nologo -bl endif CONFIG?=Release WASM_DEFAULT_BUILD_ARGS?=/p:TargetArchitecture=wasm /p:TargetOS=Browser /p:Configuration=$(CONFIG) # if we're in a container, don't try to open the browser ifneq ("$(wildcard /.dockerenv)", "") OPEN_BROWSER= V8_PATH=v8 else OPEN_BROWSER=-o V8_PATH=~/.jsvu/v8 endif all: publish build: EMSDK_PATH=$(realpath $(TOP)/src/mono/wasm/emsdk) $(DOTNET) build $(DOTNET_Q_ARGS) $(WASM_DEFAULT_BUILD_ARGS) $(MSBUILD_ARGS) $(PROJECT_NAME) publish: EMSDK_PATH=$(realpath $(TOP)/src/mono/wasm/emsdk) $(DOTNET) publish $(DOTNET_Q_ARGS) $(WASM_DEFAULT_BUILD_ARGS) -p:WasmBuildOnlyAfterPublish=true $(MSBUILD_ARGS) $(PROJECT_NAME) clean: rm -rf bin $(TOP)/artifacts/obj/mono/$(PROJECT_NAME:%.csproj=%) run-browser: if ! $(DOTNET) tool list --global | grep dotnet-serve && ! which dotnet-serve ; then \ echo "The tool dotnet-serve could not be found. Install with: $(DOTNET) tool install --global dotnet-serve"; \ exit 1; \ else \ $(DOTNET) serve -d:bin/$(CONFIG)/AppBundle $(OPEN_BROWSER) -p:8000; \ fi run-console: cd bin/$(CONFIG)/AppBundle && $(V8_PATH) --stack-trace-limit=1000 --single-threaded --expose_wasm $(MAIN_JS) -- $(ARGS) run-console-node: cd bin/$(CONFIG)/AppBundle && node --stack-trace-limit=1000 --single-threaded --expose_wasm $(MAIN_JS) $(ARGS)
1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/mono/wasm/build/WasmApp.targets
<Project> <UsingTask TaskName="WasmAppBuilder" AssemblyFile="$(WasmAppBuilderTasksAssemblyPath)" /> <UsingTask TaskName="WasmLoadAssembliesAndReferences" AssemblyFile="$(WasmAppBuilderTasksAssemblyPath)" /> <!-- Required public items/properties: - $(WasmMainJSPath) - $(EMSDK_PATH) - points to the emscripten sdk location. Public properties (optional): - $(WasmAppDir) - AppBundle dir (Defaults to `$(OutputPath)\$(Configuration)\AppBundle`) - $(WasmMainAssemblyFileName)- Defaults to $(TargetFileName) - $(WasmBuildNative) - Whenever to build the native executable. Defaults to false. - $(WasmNativeStrip) - Whenever to strip the native executable. Defaults to true. - $(WasmLinkIcalls) - Whenever to link out unused icalls. Defaults to $(WasmBuildNative). - $(RunAOTCompilation) - Defaults to false. - $(WasmDebugLevel) > 0 enables debugging and sets the debug log level to debug_level == 0 disables debugging and enables interpreter optimizations < 0 enabled debugging and disables debug logging. - $(WasmNativeDebugSymbols) - Build with native debug symbols, useful only with `$(RunAOTCompilation)`, or `$(WasmBuildNative)` Defaults to true. - $(WasmEmitSymbolMap) - Generates a `dotnet.js.symbols` file with a map of wasm function number to name. - $(WasmDedup) - Whenever to dedup generic instances when using AOT. Defaults to true. - $(WasmProfilers) - Profilers to use - $(AOTMode) - Defaults to `LLVMOnlyInterp` - $(AOTProfilePath) - profile data file to be used for profile-guided optimization - $(InvariantGlobalization) - Whenever to disable ICU. Defaults to false. - $(WasmResolveAssembliesBeforeBuild) - Resolve the assembly dependencies. Defaults to false - $(WasmAssemblySearchPaths) - used for resolving assembly dependencies - $(WasmSkipMissingAssemblies) - Don't fail on any missing dependencies - $(WasmGenerateAppBundle) - Controls whether an app bundle should be generated. Defaults to true. This is useful for projects that want to handle their own packaging, or app bundle generation, eg. Blazor. - $(WasmStripAOTAssemblies) - Whether to run `mono-cil-strip` on the assemblies. Always set to false! - $(EmccVerbose) - Set to false to disable verbose emcc output. - $(EmccLinkOptimizationFlag) - Optimization flag to use for the link step - $(EmccCompileOptimizationFlag) - Optimization flag to use for compiling native files - $(EmccFlags) - Emcc flags used for both compiling native files, and linking - $(EmccExtraLDFlags) - Extra emcc flags for linking - $(EmccExtraCFlags) - Extra emcc flags for compiling native files - $(EmccInitialMemory) - Initial memory specified with `emcc`. Default value: 536870912 (previously named EmccTotalMemory, which is still kept as an alias) - $(WasmBuildAppAfterThisTarget) - This target is used as `AfterTargets` for `WasmBuildApp. this is what triggers the wasm app building. Defaults to `Build`. - $(WasmTriggerPublishAppAfterThisTarget) - This target is used as `AfterTargets` for `WasmTriggerPublishApp. Defaults to `Publish`. - $(EnableDefaultWasmAssembliesToBundle) - Get list of assemblies to bundle automatically. Defaults to true. - $(WasmBuildOnlyAfterPublish) - Causes relinking to be done only for Publish. Defaults to false. - $(RunAOTCompilationAfterBuild) - Run AOT compilation even after Build. By default, it is run only for publish. Defaults to false. - $(WasmAotProfilePath) - Path to an AOT profile file. Public items: - @(WasmExtraFilesToDeploy) - Files to copy to $(WasmAppDir). (relative path can be set via %(TargetPath) metadata) - @(WasmFilesToIncludeInFileSystem) - Files to include in the vfs - @(WasmNativeAsset) - Native files to be added to `NativeAssets` in the bundle. - @(WasmExtraConfig) - json elements to add to `mono-config.json` Eg. <WasmExtraConfig Include="enable_profiler" Value="true" /> - Value attribute can have a number, bool, quoted string, or json string <WasmExtraConfig Include="json" Value="{ &quot;abc&quot;: 4 }" /> <WasmExtraConfig Include="string_val" Value="&quot;abc&quot;" /> <WasmExtraConfig Include="string_with_json" Value="&quot;{ &quot;abc&quot;: 4 }&quot;" /> --> <PropertyGroup> <WasmDedup Condition="'$(WasmDedup)' == ''">false</WasmDedup> <!--<WasmStripAOTAssemblies Condition="'$(AOTMode)' == 'LLVMOnlyInterp'">false</WasmStripAOTAssemblies>--> <!--<WasmStripAOTAssemblies Condition="'$(WasmStripAOTAssemblies)' == ''">$(RunAOTCompilation)</WasmStripAOTAssemblies>--> <WasmStripAOTAssemblies>false</WasmStripAOTAssemblies> <_BeforeWasmBuildAppDependsOn /> <IsWasmProject Condition="'$(IsWasmProject)' == '' and '$(OutputType)' != 'Library'">true</IsWasmProject> <WasmBuildAppAfterThisTarget Condition="'$(WasmBuildAppAfterThisTarget)' == '' and '$(DisableAutoWasmBuildApp)' != 'true'">Build</WasmBuildAppAfterThisTarget> <WasmTriggerPublishAppAfterThisTarget Condition="'$(DisableAutoWasmPublishApp)' != 'true' and '$(WasmBuildingForNestedPublish)' != 'true'">Publish</WasmTriggerPublishAppAfterThisTarget> <_WasmNestedPublishAppPreTarget Condition="'$(DisableAutoWasmPublishApp)' != 'true'">Publish</_WasmNestedPublishAppPreTarget> <EnableDefaultWasmAssembliesToBundle Condition="'$(EnableDefaultWasmAssembliesToBundle)' == ''">true</EnableDefaultWasmAssembliesToBundle> <WasmBuildOnlyAfterPublish Condition="'$(WasmBuildOnlyAfterPublish)' == '' and '$(DeployOnBuild)' == 'true'">true</WasmBuildOnlyAfterPublish> <!-- Temporarily `false`, till sdk gets a fix for supporting the new file --> <WasmEmitSymbolMap Condition="'$(WasmEmitSymbolMap)' == ''">false</WasmEmitSymbolMap> </PropertyGroup> <!-- PUBLISH --> <Target Name="WasmTriggerPublishApp" AfterTargets="$(WasmTriggerPublishAppAfterThisTarget)" Condition="'$(IsWasmProject)' == 'true' and '$(WasmBuildingForNestedPublish)' != 'true' and '$(IsCrossTargetingBuild)' != 'true'"> <!-- Use a unique property, so the already run wasm targets can also run --> <MSBuild Projects="$(MSBuildProjectFile)" Targets="WasmNestedPublishApp" Properties="_WasmInNestedPublish_UniqueProperty_XYZ=true;;WasmBuildingForNestedPublish=true;DeployOnBuild="> <Output TaskParameter="TargetOutputs" ItemName="WasmNestedPublishAppResultItems" /> </MSBuild> <ItemGroup> <WasmAssembliesFinal Remove="@(WasmAssembliesFinal)" /> <WasmAssembliesFinal Include="@(WasmNestedPublishAppResultItems)" Condition="'%(WasmNestedPublishAppResultItems.OriginalItemName)' == 'WasmAssembliesFinal'" /> <WasmNativeAsset Remove="@(WasmNativeAsset)" /> <WasmNativeAsset Include="@(WasmNestedPublishAppResultItems)" Condition="'%(WasmNestedPublishAppResultItems.OriginalItemName)' == 'WasmNativeAsset'" /> <FileWrites Include="@(WasmNestedPublishAppResultItems)" Condition="'%(WasmNestedPublishAppResultItems.OriginalItemName)' == 'FileWrites'" /> </ItemGroup> </Target> <!-- Public target. Do not depend on this target, as it is meant to be run by a msbuild task --> <Target Name="WasmNestedPublishApp" DependsOnTargets="ResolveRuntimePackAssets;$(_WasmNestedPublishAppPreTarget);$(WasmNestedPublishAppDependsOn)" Condition="'$(WasmBuildingForNestedPublish)' == 'true'" Returns="@(WasmNativeAsset);@(WasmAssembliesFinal);@(FileWrites)"> <ItemGroup> <WasmNativeAsset OriginalItemName="WasmNativeAsset" /> <WasmAssembliesFinal OriginalItemName="WasmAssembliesFinal" /> <FileWrites OriginalItemName="FileWrites" /> </ItemGroup> </Target> <Target Name="_PrepareForNestedPublish" Condition="'$(WasmBuildingForNestedPublish)' == 'true'"> <PropertyGroup> <_WasmRuntimeConfigFilePath Condition="$([System.String]::new(%(PublishItemsOutputGroupOutputs.Identity)).EndsWith('$(AssemblyName).runtimeconfig.json'))">@(PublishItemsOutputGroupOutputs)</_WasmRuntimeConfigFilePath> </PropertyGroup> <ItemGroup Condition="'$(EnableDefaultWasmAssembliesToBundle)' == 'true' and '$(DisableAutoWasmPublishApp)' != 'true'"> <WasmAssembliesToBundle Remove="@(WasmAssembliesToBundle)" /> <WasmAssembliesToBundle Include="$(PublishDir)\**\*.dll" /> </ItemGroup> <PropertyGroup Condition="'$(_WasmRuntimeConfigFilePath)' == ''"> <_WasmRuntimeConfigFilePath Condition="$([System.String]::new(%(PublishItemsOutputGroupOutputs.Identity)).EndsWith('$(AssemblyName).runtimeconfig.json'))">@(PublishItemsOutputGroupOutputs)</_WasmRuntimeConfigFilePath> </PropertyGroup> </Target> <Import Project="$(MSBuildThisFileDirectory)WasmApp.Native.targets" /> <!-- public target for Build --> <Target Name="WasmBuildApp" AfterTargets="$(WasmBuildAppAfterThisTarget)" DependsOnTargets="$(WasmBuildAppDependsOn)" Condition="'$(IsWasmProject)' == 'true' and '$(WasmBuildingForNestedPublish)' == '' and '$(WasmBuildOnlyAfterPublish)' != 'true' and '$(IsCrossTargetingBuild)' != 'true'" /> <Target Name="_InitializeCommonProperties"> <Error Condition="'$(MicrosoftNetCoreAppRuntimePackDir)' == '' and ('%(ResolvedRuntimePack.PackageDirectory)' == '' or !Exists(%(ResolvedRuntimePack.PackageDirectory)))" Text="%24(MicrosoftNetCoreAppRuntimePackDir)='', and cannot find %25(ResolvedRuntimePack.PackageDirectory)=%(ResolvedRuntimePack.PackageDirectory). One of these need to be set to a valid path" /> <Error Condition="'$(IntermediateOutputPath)' == ''" Text="%24(IntermediateOutputPath) property needs to be set" /> <PropertyGroup> <MicrosoftNetCoreAppRuntimePackDir Condition="'$(MicrosoftNetCoreAppRuntimePackDir)' == ''">%(ResolvedRuntimePack.PackageDirectory)</MicrosoftNetCoreAppRuntimePackDir> <MicrosoftNetCoreAppRuntimePackRidDir Condition="'$(MicrosoftNetCoreAppRuntimePackRidDir)' == ''">$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackDir), 'runtimes', 'browser-wasm'))</MicrosoftNetCoreAppRuntimePackRidDir> <MicrosoftNetCoreAppRuntimePackRidDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir)))</MicrosoftNetCoreAppRuntimePackRidDir> <MicrosoftNetCoreAppRuntimePackRidNativeDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir), 'native'))</MicrosoftNetCoreAppRuntimePackRidNativeDir> <_WasmRuntimePackIncludeDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'include'))</_WasmRuntimePackIncludeDir> <_WasmRuntimePackSrcDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'src'))</_WasmRuntimePackSrcDir> <_WasmIntermediateOutputPath Condition="'$(WasmBuildingForNestedPublish)' == ''">$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'wasm', 'for-build'))</_WasmIntermediateOutputPath> <_WasmIntermediateOutputPath Condition="'$(WasmBuildingForNestedPublish)' != ''">$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'wasm', 'for-publish'))</_WasmIntermediateOutputPath> <_DriverGenCPath>$(_WasmIntermediateOutputPath)driver-gen.c</_DriverGenCPath> <_WasmShouldAOT Condition="'$(WasmBuildingForNestedPublish)' == 'true' and '$(RunAOTCompilation)' == 'true'">true</_WasmShouldAOT> <_WasmShouldAOT Condition="'$(RunAOTCompilationAfterBuild)' == 'true' and '$(RunAOTCompilation)' == 'true'">true</_WasmShouldAOT> <_WasmShouldAOT Condition="'$(_WasmShouldAOT)' == ''">false</_WasmShouldAOT> </PropertyGroup> <MakeDir Directories="$(WasmCachePath)" Condition="'$(WasmCachePath)' != '' and !Exists($(WasmCachePath))" /> <MakeDir Directories="$(_WasmIntermediateOutputPath)" /> </Target> <Target Name="_PrepareForAfterBuild" Condition="'$(WasmBuildingForNestedPublish)' != 'true'"> <ItemGroup Condition="'$(EnableDefaultWasmAssembliesToBundle)' == 'true'"> <WasmAssembliesToBundle Include="@(ReferenceCopyLocalPaths);@(MainAssembly)" Condition="'%(ReferenceCopyLocalPaths.Extension)' == '.dll'" /> </ItemGroup> </Target> <Target Name="_BeforeWasmBuildApp" DependsOnTargets="$(_BeforeWasmBuildAppDependsOn)"> <Error Condition="!Exists('$(MicrosoftNetCoreAppRuntimePackRidDir)')" Text="MicrosoftNetCoreAppRuntimePackRidDir=$(MicrosoftNetCoreAppRuntimePackRidDir) doesn't exist" /> <Error Condition="@(WasmAssembliesToBundle->Count()) == 0" Text="WasmAssembliesToBundle item is empty. No assemblies to process" /> <PropertyGroup> <WasmGenerateAppBundle Condition="'$(WasmGenerateAppBundle)' == '' and '$(OutputType)' != 'Library'">true</WasmGenerateAppBundle> <WasmGenerateAppBundle Condition="'$(WasmGenerateAppBundle)' == ''">false</WasmGenerateAppBundle> <WasmAppDir Condition="'$(WasmAppDir)' == ''">$([MSBuild]::NormalizeDirectory($(OutputPath), 'AppBundle'))</WasmAppDir> <WasmMainAssemblyFileName Condition="'$(WasmMainAssemblyFileName)' == ''">$(TargetFileName)</WasmMainAssemblyFileName> <WasmAppDir>$([MSBuild]::NormalizeDirectory($(WasmAppDir)))</WasmAppDir> <_MainAssemblyPath Condition="'%(WasmAssembliesToBundle.FileName)' == $(AssemblyName) and '%(WasmAssembliesToBundle.Extension)' == '.dll' and $(WasmGenerateAppBundle) == 'true'">%(WasmAssembliesToBundle.Identity)</_MainAssemblyPath> <_WasmRuntimeConfigFilePath Condition="'$(_WasmRuntimeConfigFilePath)' == '' and $(_MainAssemblyPath) != ''">$([System.IO.Path]::ChangeExtension($(_MainAssemblyPath), '.runtimeconfig.json'))</_WasmRuntimeConfigFilePath> <_ParsedRuntimeConfigFilePath Condition="'$(_WasmRuntimeConfigFilePath)' != ''">$([System.IO.Path]::GetDirectoryName($(_WasmRuntimeConfigFilePath)))\runtimeconfig.bin</_ParsedRuntimeConfigFilePath> </PropertyGroup> <Message Condition="'$(WasmGenerateAppBundle)' == 'true' and $(_MainAssemblyPath) == ''" Text="Could not find %24(AssemblyName)=$(AssemblyName).dll in the assemblies to be bundled." Importance="Low" /> <Message Condition="'$(WasmGenerateAppBundle)' == 'true' and $(_WasmRuntimeConfigFilePath) != '' and !Exists($(_WasmRuntimeConfigFilePath))" Text="Could not find $(_WasmRuntimeConfigFilePath) for $(_MainAssemblyPath)." Importance="Low" /> <ItemGroup> <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" /> <_WasmAssembliesInternal Include="@(WasmAssembliesToBundle->Distinct())" /> <_WasmSatelliteAssemblies Remove="@(_WasmSatelliteAssemblies)" /> <_WasmSatelliteAssemblies Include="@(_WasmAssembliesInternal)" /> <_WasmSatelliteAssemblies Remove="@(_WasmSatelliteAssemblies)" Condition="!$([System.String]::Copy('%(Identity)').EndsWith('.resources.dll'))" /> <!-- FIXME: Only include the ones with valid culture name --> <_WasmSatelliteAssemblies CultureName="$([System.IO.Directory]::GetParent('%(Identity)').Name)" /> <_WasmAssembliesInternal Remove="@(_WasmSatelliteAssemblies)" /> </ItemGroup> </Target> <Target Name="_WasmGenerateRuntimeConfig" Inputs="$(_WasmRuntimeConfigFilePath)" Outputs="$(_ParsedRuntimeConfigFilePath)" Condition="Exists('$(_WasmRuntimeConfigFilePath)')"> <ItemGroup> <_RuntimeConfigReservedProperties Include="RUNTIME_IDENTIFIER"/> <_RuntimeConfigReservedProperties Include="APP_CONTEXT_BASE_DIRECTORY"/> </ItemGroup> <RuntimeConfigParserTask RuntimeConfigFile="$(_WasmRuntimeConfigFilePath)" OutputFile="$(_ParsedRuntimeConfigFilePath)" RuntimeConfigReservedProperties="@(_RuntimeConfigReservedProperties)"> </RuntimeConfigParserTask> <ItemGroup> <WasmFilesToIncludeInFileSystem Include="$(_ParsedRuntimeConfigFilePath)" /> </ItemGroup> </Target> <Target Name="_GetWasmGenerateAppBundleDependencies"> <PropertyGroup> <WasmIcuDataFileName Condition="'$(InvariantGlobalization)' != 'true'">icudt.dat</WasmIcuDataFileName> <_HasDotnetWasm Condition="'%(WasmNativeAsset.FileName)%(WasmNativeAsset.Extension)' == 'dotnet.wasm'">true</_HasDotnetWasm> <_HasDotnetJsSymbols Condition="'%(WasmNativeAsset.FileName)%(WasmNativeAsset.Extension)' == 'dotnet.js.symbols'">true</_HasDotnetJsSymbols> <_HasDotnetJs Condition="'%(WasmNativeAsset.FileName)%(WasmNativeAsset.Extension)' == 'dotnet.js'">true</_HasDotnetJs> </PropertyGroup> <ItemGroup> <!-- If dotnet.{wasm,js} weren't added already (eg. AOT can add them), then add the default ones --> <WasmNativeAsset Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)dotnet.wasm" Condition="'$(_HasDotnetWasm)' != 'true'" /> <WasmNativeAsset Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)dotnet.js" Condition="'$(_HasDotnetJs)' != 'true'" /> <WasmNativeAsset Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)dotnet.js.symbols" Condition="'$(WasmEmitSymbolMap)' == 'true' and '$(_HasDotnetJs)' != 'true' and Exists('$(MicrosoftNetCoreAppRuntimePackRidNativeDir)dotnet.js.symbols')" /> <WasmNativeAsset Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)$(WasmIcuDataFileName)" Condition="'$(InvariantGlobalization)' != 'true'" /> <WasmNativeAsset Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)dotnet.timezones.blat" /> <WasmFilesToIncludeInFileSystem Include="@(WasmNativeAsset)" Condition="'%(WasmNativeAsset.FileName)%(WasmNativeAsset.Extension)' == 'dotnet.js.symbols'" /> </ItemGroup> </Target> <Target Name="_WasmGenerateAppBundle" Inputs="@(_WasmAssembliesInternal);$(WasmMainJSPath);$(WasmIcuDataFileName);@(WasmNativeAsset)" Outputs="$(WasmAppDir)\.stamp" Condition="'$(WasmGenerateAppBundle)' == 'true'" DependsOnTargets="_WasmGenerateRuntimeConfig;_GetWasmGenerateAppBundleDependencies"> <Error Condition="'$(WasmMainJSPath)' == ''" Text="%24(WasmMainJSPath) property needs to be set" /> <RemoveDir Directories="$(WasmAppDir)" /> <WasmAppBuilder AppDir="$(WasmAppDir)" MainJS="$(WasmMainJSPath)" Assemblies="@(_WasmAssembliesInternal)" InvariantGlobalization="$(InvariantGlobalization)" SatelliteAssemblies="@(_WasmSatelliteAssemblies)" FilesToIncludeInFileSystem="@(WasmFilesToIncludeInFileSystem)" IcuDataFileName="$(WasmIcuDataFileName)" RemoteSources="@(WasmRemoteSources)" ExtraFilesToDeploy="@(WasmExtraFilesToDeploy)" ExtraConfig="@(WasmExtraConfig)" NativeAssets="@(WasmNativeAsset)" DebugLevel="$(WasmDebugLevel)"> <Output TaskParameter="FileWrites" ItemName="FileWrites" /> </WasmAppBuilder> <CallTarget Targets="_GenerateRunV8Script" Condition="'$(WasmGenerateRunV8Script)' == 'true'" /> <WriteLinesToFile File="$(WasmAppDir)\.stamp" Lines="" Overwrite="true" /> </Target> <Target Name="_GenerateRunV8Script"> <PropertyGroup> <WasmRunV8ScriptPath Condition="'$(WasmRunV8ScriptPath)' == ''">$(WasmAppDir)run-v8.sh</WasmRunV8ScriptPath> <_WasmMainJSFileName>$([System.IO.Path]::GetFileName('$(WasmMainJSPath)'))</_WasmMainJSFileName> </PropertyGroup> <Error Condition="'$(WasmMainAssemblyFileName)' == ''" Text="%24(WasmMainAssemblyFileName) property needs to be set for generating $(WasmRunV8ScriptPath)." /> <WriteLinesToFile File="$(WasmRunV8ScriptPath)" Lines="v8 --expose_wasm $(_WasmMainJSFileName) -- ${RUNTIME_ARGS} --run $(WasmMainAssemblyFileName) $*" Overwrite="true"> </WriteLinesToFile> <ItemGroup> <FileWrites Include="$(WasmRunV8ScriptPath)" /> </ItemGroup> <Exec Condition="'$(OS)' != 'Windows_NT'" Command="chmod a+x $(WasmRunV8ScriptPath)" /> </Target> <Target Name="_WasmResolveReferences" Condition="'$(WasmResolveAssembliesBeforeBuild)' == 'true'"> <WasmLoadAssembliesAndReferences Assemblies="@(_WasmAssembliesInternal)" AssemblySearchPaths="@(WasmAssemblySearchPaths)" SkipMissingAssemblies="$(WasmSkipMissingAssemblies)"> <Output TaskParameter="ReferencedAssemblies" ItemName="_TmpWasmAssemblies" /> </WasmLoadAssembliesAndReferences> <ItemGroup> <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" /> <_WasmAssembliesInternal Include="@(_TmpWasmAssemblies)" /> </ItemGroup> </Target> <Target Name="_AfterWasmBuildApp"> <ItemGroup> <WasmAssembliesFinal Include="@(_WasmAssembliesInternal)" LlvmBitCodeFile="" /> </ItemGroup> </Target> </Project>
<Project> <UsingTask TaskName="WasmAppBuilder" AssemblyFile="$(WasmAppBuilderTasksAssemblyPath)" /> <UsingTask TaskName="WasmLoadAssembliesAndReferences" AssemblyFile="$(WasmAppBuilderTasksAssemblyPath)" /> <!-- Required public items/properties: - $(WasmMainJSPath) - $(EMSDK_PATH) - points to the emscripten sdk location. Public properties (optional): - $(WasmAppDir) - AppBundle dir (Defaults to `$(OutputPath)\$(Configuration)\AppBundle`) - $(WasmMainAssemblyFileName)- Defaults to $(TargetFileName) - $(WasmBuildNative) - Whenever to build the native executable. Defaults to false. - $(WasmNativeStrip) - Whenever to strip the native executable. Defaults to true. - $(WasmLinkIcalls) - Whenever to link out unused icalls. Defaults to $(WasmBuildNative). - $(RunAOTCompilation) - Defaults to false. - $(WasmDebugLevel) > 0 enables debugging and sets the debug log level to debug_level == 0 disables debugging and enables interpreter optimizations < 0 enabled debugging and disables debug logging. - $(WasmNativeDebugSymbols) - Build with native debug symbols, useful only with `$(RunAOTCompilation)`, or `$(WasmBuildNative)` Defaults to true. - $(WasmEmitSymbolMap) - Generates a `dotnet.js.symbols` file with a map of wasm function number to name. - $(WasmDedup) - Whenever to dedup generic instances when using AOT. Defaults to true. - $(WasmProfilers) - Profilers to use - $(AOTMode) - Defaults to `LLVMOnlyInterp` - $(AOTProfilePath) - profile data file to be used for profile-guided optimization - $(InvariantGlobalization) - Whenever to disable ICU. Defaults to false. - $(WasmResolveAssembliesBeforeBuild) - Resolve the assembly dependencies. Defaults to false - $(WasmAssemblySearchPaths) - used for resolving assembly dependencies - $(WasmSkipMissingAssemblies) - Don't fail on any missing dependencies - $(WasmGenerateAppBundle) - Controls whether an app bundle should be generated. Defaults to true. This is useful for projects that want to handle their own packaging, or app bundle generation, eg. Blazor. - $(WasmStripAOTAssemblies) - Whether to run `mono-cil-strip` on the assemblies. Always set to false! - $(EmccVerbose) - Set to false to disable verbose emcc output. - $(EmccLinkOptimizationFlag) - Optimization flag to use for the link step - $(EmccCompileOptimizationFlag) - Optimization flag to use for compiling native files - $(EmccFlags) - Emcc flags used for both compiling native files, and linking - $(EmccExtraLDFlags) - Extra emcc flags for linking - $(EmccExtraCFlags) - Extra emcc flags for compiling native files - $(EmccInitialMemory) - Initial memory specified with `emcc`. Default value: 536870912 (previously named EmccTotalMemory, which is still kept as an alias) - $(WasmBuildAppAfterThisTarget) - This target is used as `AfterTargets` for `WasmBuildApp. this is what triggers the wasm app building. Defaults to `Build`. - $(WasmTriggerPublishAppAfterThisTarget) - This target is used as `AfterTargets` for `WasmTriggerPublishApp. Defaults to `Publish`. - $(EnableDefaultWasmAssembliesToBundle) - Get list of assemblies to bundle automatically. Defaults to true. - $(WasmBuildOnlyAfterPublish) - Causes relinking to be done only for Publish. Defaults to false. - $(RunAOTCompilationAfterBuild) - Run AOT compilation even after Build. By default, it is run only for publish. Defaults to false. - $(WasmAotProfilePath) - Path to an AOT profile file. Public items: - @(WasmExtraFilesToDeploy) - Files to copy to $(WasmAppDir). (relative path can be set via %(TargetPath) metadata) - @(WasmFilesToIncludeInFileSystem) - Files to include in the vfs - @(WasmNativeAsset) - Native files to be added to `NativeAssets` in the bundle. - @(WasmExtraConfig) - json elements to add to `mono-config.json` Eg. <WasmExtraConfig Include="enable_profiler" Value="true" /> - Value attribute can have a number, bool, quoted string, or json string <WasmExtraConfig Include="json" Value="{ &quot;abc&quot;: 4 }" /> <WasmExtraConfig Include="string_val" Value="&quot;abc&quot;" /> <WasmExtraConfig Include="string_with_json" Value="&quot;{ &quot;abc&quot;: 4 }&quot;" /> --> <PropertyGroup> <WasmDedup Condition="'$(WasmDedup)' == ''">false</WasmDedup> <!--<WasmStripAOTAssemblies Condition="'$(AOTMode)' == 'LLVMOnlyInterp'">false</WasmStripAOTAssemblies>--> <!--<WasmStripAOTAssemblies Condition="'$(WasmStripAOTAssemblies)' == ''">$(RunAOTCompilation)</WasmStripAOTAssemblies>--> <WasmStripAOTAssemblies>false</WasmStripAOTAssemblies> <_BeforeWasmBuildAppDependsOn /> <IsWasmProject Condition="'$(IsWasmProject)' == '' and '$(OutputType)' != 'Library'">true</IsWasmProject> <WasmBuildAppAfterThisTarget Condition="'$(WasmBuildAppAfterThisTarget)' == '' and '$(DisableAutoWasmBuildApp)' != 'true'">Build</WasmBuildAppAfterThisTarget> <WasmTriggerPublishAppAfterThisTarget Condition="'$(DisableAutoWasmPublishApp)' != 'true' and '$(WasmBuildingForNestedPublish)' != 'true'">Publish</WasmTriggerPublishAppAfterThisTarget> <_WasmNestedPublishAppPreTarget Condition="'$(DisableAutoWasmPublishApp)' != 'true'">Publish</_WasmNestedPublishAppPreTarget> <EnableDefaultWasmAssembliesToBundle Condition="'$(EnableDefaultWasmAssembliesToBundle)' == ''">true</EnableDefaultWasmAssembliesToBundle> <WasmBuildOnlyAfterPublish Condition="'$(WasmBuildOnlyAfterPublish)' == '' and '$(DeployOnBuild)' == 'true'">true</WasmBuildOnlyAfterPublish> </PropertyGroup> <!-- PUBLISH --> <Target Name="WasmTriggerPublishApp" AfterTargets="$(WasmTriggerPublishAppAfterThisTarget)" Condition="'$(IsWasmProject)' == 'true' and '$(WasmBuildingForNestedPublish)' != 'true' and '$(IsCrossTargetingBuild)' != 'true'"> <!-- Use a unique property, so the already run wasm targets can also run --> <MSBuild Projects="$(MSBuildProjectFile)" Targets="WasmNestedPublishApp" Properties="_WasmInNestedPublish_UniqueProperty_XYZ=true;;WasmBuildingForNestedPublish=true;DeployOnBuild="> <Output TaskParameter="TargetOutputs" ItemName="WasmNestedPublishAppResultItems" /> </MSBuild> <ItemGroup> <WasmAssembliesFinal Remove="@(WasmAssembliesFinal)" /> <WasmAssembliesFinal Include="@(WasmNestedPublishAppResultItems)" Condition="'%(WasmNestedPublishAppResultItems.OriginalItemName)' == 'WasmAssembliesFinal'" /> <WasmNativeAsset Remove="@(WasmNativeAsset)" /> <WasmNativeAsset Include="@(WasmNestedPublishAppResultItems)" Condition="'%(WasmNestedPublishAppResultItems.OriginalItemName)' == 'WasmNativeAsset'" /> <FileWrites Include="@(WasmNestedPublishAppResultItems)" Condition="'%(WasmNestedPublishAppResultItems.OriginalItemName)' == 'FileWrites'" /> </ItemGroup> </Target> <!-- Public target. Do not depend on this target, as it is meant to be run by a msbuild task --> <Target Name="WasmNestedPublishApp" DependsOnTargets="ResolveRuntimePackAssets;$(_WasmNestedPublishAppPreTarget);$(WasmNestedPublishAppDependsOn)" Condition="'$(WasmBuildingForNestedPublish)' == 'true'" Returns="@(WasmNativeAsset);@(WasmAssembliesFinal);@(FileWrites)"> <ItemGroup> <WasmNativeAsset OriginalItemName="WasmNativeAsset" /> <WasmAssembliesFinal OriginalItemName="WasmAssembliesFinal" /> <FileWrites OriginalItemName="FileWrites" /> </ItemGroup> </Target> <Target Name="_PrepareForNestedPublish" Condition="'$(WasmBuildingForNestedPublish)' == 'true'"> <PropertyGroup> <_WasmRuntimeConfigFilePath Condition="$([System.String]::new(%(PublishItemsOutputGroupOutputs.Identity)).EndsWith('$(AssemblyName).runtimeconfig.json'))">@(PublishItemsOutputGroupOutputs)</_WasmRuntimeConfigFilePath> </PropertyGroup> <ItemGroup Condition="'$(EnableDefaultWasmAssembliesToBundle)' == 'true' and '$(DisableAutoWasmPublishApp)' != 'true'"> <WasmAssembliesToBundle Remove="@(WasmAssembliesToBundle)" /> <WasmAssembliesToBundle Include="$(PublishDir)\**\*.dll" /> </ItemGroup> <PropertyGroup Condition="'$(_WasmRuntimeConfigFilePath)' == ''"> <_WasmRuntimeConfigFilePath Condition="$([System.String]::new(%(PublishItemsOutputGroupOutputs.Identity)).EndsWith('$(AssemblyName).runtimeconfig.json'))">@(PublishItemsOutputGroupOutputs)</_WasmRuntimeConfigFilePath> </PropertyGroup> </Target> <Import Project="$(MSBuildThisFileDirectory)WasmApp.Native.targets" /> <!-- public target for Build --> <Target Name="WasmBuildApp" AfterTargets="$(WasmBuildAppAfterThisTarget)" DependsOnTargets="$(WasmBuildAppDependsOn)" Condition="'$(IsWasmProject)' == 'true' and '$(WasmBuildingForNestedPublish)' == '' and '$(WasmBuildOnlyAfterPublish)' != 'true' and '$(IsCrossTargetingBuild)' != 'true'" /> <Target Name="_InitializeCommonProperties"> <Error Condition="'$(MicrosoftNetCoreAppRuntimePackDir)' == '' and ('%(ResolvedRuntimePack.PackageDirectory)' == '' or !Exists(%(ResolvedRuntimePack.PackageDirectory)))" Text="%24(MicrosoftNetCoreAppRuntimePackDir)='', and cannot find %25(ResolvedRuntimePack.PackageDirectory)=%(ResolvedRuntimePack.PackageDirectory). One of these need to be set to a valid path" /> <Error Condition="'$(IntermediateOutputPath)' == ''" Text="%24(IntermediateOutputPath) property needs to be set" /> <PropertyGroup> <MicrosoftNetCoreAppRuntimePackDir Condition="'$(MicrosoftNetCoreAppRuntimePackDir)' == ''">%(ResolvedRuntimePack.PackageDirectory)</MicrosoftNetCoreAppRuntimePackDir> <MicrosoftNetCoreAppRuntimePackRidDir Condition="'$(MicrosoftNetCoreAppRuntimePackRidDir)' == ''">$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackDir), 'runtimes', 'browser-wasm'))</MicrosoftNetCoreAppRuntimePackRidDir> <MicrosoftNetCoreAppRuntimePackRidDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir)))</MicrosoftNetCoreAppRuntimePackRidDir> <MicrosoftNetCoreAppRuntimePackRidNativeDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidDir), 'native'))</MicrosoftNetCoreAppRuntimePackRidNativeDir> <_WasmRuntimePackIncludeDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'include'))</_WasmRuntimePackIncludeDir> <_WasmRuntimePackSrcDir>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'src'))</_WasmRuntimePackSrcDir> <_WasmIntermediateOutputPath Condition="'$(WasmBuildingForNestedPublish)' == ''">$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'wasm', 'for-build'))</_WasmIntermediateOutputPath> <_WasmIntermediateOutputPath Condition="'$(WasmBuildingForNestedPublish)' != ''">$([MSBuild]::NormalizeDirectory($(IntermediateOutputPath), 'wasm', 'for-publish'))</_WasmIntermediateOutputPath> <_DriverGenCPath>$(_WasmIntermediateOutputPath)driver-gen.c</_DriverGenCPath> <_WasmShouldAOT Condition="'$(WasmBuildingForNestedPublish)' == 'true' and '$(RunAOTCompilation)' == 'true'">true</_WasmShouldAOT> <_WasmShouldAOT Condition="'$(RunAOTCompilationAfterBuild)' == 'true' and '$(RunAOTCompilation)' == 'true'">true</_WasmShouldAOT> <_WasmShouldAOT Condition="'$(_WasmShouldAOT)' == ''">false</_WasmShouldAOT> </PropertyGroup> <MakeDir Directories="$(WasmCachePath)" Condition="'$(WasmCachePath)' != '' and !Exists($(WasmCachePath))" /> <MakeDir Directories="$(_WasmIntermediateOutputPath)" /> </Target> <Target Name="_PrepareForAfterBuild" Condition="'$(WasmBuildingForNestedPublish)' != 'true'"> <ItemGroup Condition="'$(EnableDefaultWasmAssembliesToBundle)' == 'true'"> <WasmAssembliesToBundle Include="@(ReferenceCopyLocalPaths);@(MainAssembly)" Condition="'%(ReferenceCopyLocalPaths.Extension)' == '.dll'" /> </ItemGroup> </Target> <Target Name="_BeforeWasmBuildApp" DependsOnTargets="$(_BeforeWasmBuildAppDependsOn)"> <Error Condition="!Exists('$(MicrosoftNetCoreAppRuntimePackRidDir)')" Text="MicrosoftNetCoreAppRuntimePackRidDir=$(MicrosoftNetCoreAppRuntimePackRidDir) doesn't exist" /> <Error Condition="@(WasmAssembliesToBundle->Count()) == 0" Text="WasmAssembliesToBundle item is empty. No assemblies to process" /> <PropertyGroup> <WasmGenerateAppBundle Condition="'$(WasmGenerateAppBundle)' == '' and '$(OutputType)' != 'Library'">true</WasmGenerateAppBundle> <WasmGenerateAppBundle Condition="'$(WasmGenerateAppBundle)' == ''">false</WasmGenerateAppBundle> <WasmAppDir Condition="'$(WasmAppDir)' == ''">$([MSBuild]::NormalizeDirectory($(OutputPath), 'AppBundle'))</WasmAppDir> <WasmMainAssemblyFileName Condition="'$(WasmMainAssemblyFileName)' == ''">$(TargetFileName)</WasmMainAssemblyFileName> <WasmAppDir>$([MSBuild]::NormalizeDirectory($(WasmAppDir)))</WasmAppDir> <_MainAssemblyPath Condition="'%(WasmAssembliesToBundle.FileName)' == $(AssemblyName) and '%(WasmAssembliesToBundle.Extension)' == '.dll' and $(WasmGenerateAppBundle) == 'true'">%(WasmAssembliesToBundle.Identity)</_MainAssemblyPath> <_WasmRuntimeConfigFilePath Condition="'$(_WasmRuntimeConfigFilePath)' == '' and $(_MainAssemblyPath) != ''">$([System.IO.Path]::ChangeExtension($(_MainAssemblyPath), '.runtimeconfig.json'))</_WasmRuntimeConfigFilePath> <_ParsedRuntimeConfigFilePath Condition="'$(_WasmRuntimeConfigFilePath)' != ''">$([System.IO.Path]::GetDirectoryName($(_WasmRuntimeConfigFilePath)))\runtimeconfig.bin</_ParsedRuntimeConfigFilePath> </PropertyGroup> <Message Condition="'$(WasmGenerateAppBundle)' == 'true' and $(_MainAssemblyPath) == ''" Text="Could not find %24(AssemblyName)=$(AssemblyName).dll in the assemblies to be bundled." Importance="Low" /> <Message Condition="'$(WasmGenerateAppBundle)' == 'true' and $(_WasmRuntimeConfigFilePath) != '' and !Exists($(_WasmRuntimeConfigFilePath))" Text="Could not find $(_WasmRuntimeConfigFilePath) for $(_MainAssemblyPath)." Importance="Low" /> <ItemGroup> <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" /> <_WasmAssembliesInternal Include="@(WasmAssembliesToBundle->Distinct())" /> <_WasmSatelliteAssemblies Remove="@(_WasmSatelliteAssemblies)" /> <_WasmSatelliteAssemblies Include="@(_WasmAssembliesInternal)" /> <_WasmSatelliteAssemblies Remove="@(_WasmSatelliteAssemblies)" Condition="!$([System.String]::Copy('%(Identity)').EndsWith('.resources.dll'))" /> <!-- FIXME: Only include the ones with valid culture name --> <_WasmSatelliteAssemblies CultureName="$([System.IO.Directory]::GetParent('%(Identity)').Name)" /> <_WasmAssembliesInternal Remove="@(_WasmSatelliteAssemblies)" /> </ItemGroup> </Target> <Target Name="_WasmGenerateRuntimeConfig" Inputs="$(_WasmRuntimeConfigFilePath)" Outputs="$(_ParsedRuntimeConfigFilePath)" Condition="Exists('$(_WasmRuntimeConfigFilePath)')"> <ItemGroup> <_RuntimeConfigReservedProperties Include="RUNTIME_IDENTIFIER"/> <_RuntimeConfigReservedProperties Include="APP_CONTEXT_BASE_DIRECTORY"/> </ItemGroup> <RuntimeConfigParserTask RuntimeConfigFile="$(_WasmRuntimeConfigFilePath)" OutputFile="$(_ParsedRuntimeConfigFilePath)" RuntimeConfigReservedProperties="@(_RuntimeConfigReservedProperties)"> </RuntimeConfigParserTask> <ItemGroup> <WasmFilesToIncludeInFileSystem Include="$(_ParsedRuntimeConfigFilePath)" /> </ItemGroup> </Target> <Target Name="_GetWasmGenerateAppBundleDependencies"> <PropertyGroup> <WasmIcuDataFileName Condition="'$(InvariantGlobalization)' != 'true'">icudt.dat</WasmIcuDataFileName> <_HasDotnetWasm Condition="'%(WasmNativeAsset.FileName)%(WasmNativeAsset.Extension)' == 'dotnet.wasm'">true</_HasDotnetWasm> <_HasDotnetJsSymbols Condition="'%(WasmNativeAsset.FileName)%(WasmNativeAsset.Extension)' == 'dotnet.js.symbols'">true</_HasDotnetJsSymbols> <_HasDotnetJs Condition="'%(WasmNativeAsset.FileName)%(WasmNativeAsset.Extension)' == 'dotnet.js'">true</_HasDotnetJs> </PropertyGroup> <ItemGroup> <!-- If dotnet.{wasm,js} weren't added already (eg. AOT can add them), then add the default ones --> <WasmNativeAsset Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)dotnet.wasm" Condition="'$(_HasDotnetWasm)' != 'true'" /> <WasmNativeAsset Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)dotnet.js" Condition="'$(_HasDotnetJs)' != 'true'" /> <WasmNativeAsset Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)dotnet.js.symbols" Condition="'$(WasmEmitSymbolMap)' == 'true' and '$(_HasDotnetJs)' != 'true' and Exists('$(MicrosoftNetCoreAppRuntimePackRidNativeDir)dotnet.js.symbols')" /> <WasmNativeAsset Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)$(WasmIcuDataFileName)" Condition="'$(InvariantGlobalization)' != 'true'" /> <WasmNativeAsset Include="$(MicrosoftNetCoreAppRuntimePackRidNativeDir)dotnet.timezones.blat" /> <WasmFilesToIncludeInFileSystem Include="@(WasmNativeAsset)" Condition="'%(WasmNativeAsset.FileName)%(WasmNativeAsset.Extension)' == 'dotnet.js.symbols'" /> </ItemGroup> </Target> <Target Name="_WasmGenerateAppBundle" Inputs="@(_WasmAssembliesInternal);$(WasmMainJSPath);$(WasmIcuDataFileName);@(WasmNativeAsset)" Outputs="$(WasmAppDir)\.stamp" Condition="'$(WasmGenerateAppBundle)' == 'true'" DependsOnTargets="_WasmGenerateRuntimeConfig;_GetWasmGenerateAppBundleDependencies"> <Error Condition="'$(WasmMainJSPath)' == ''" Text="%24(WasmMainJSPath) property needs to be set" /> <RemoveDir Directories="$(WasmAppDir)" /> <WasmAppBuilder AppDir="$(WasmAppDir)" MainJS="$(WasmMainJSPath)" Assemblies="@(_WasmAssembliesInternal)" InvariantGlobalization="$(InvariantGlobalization)" SatelliteAssemblies="@(_WasmSatelliteAssemblies)" FilesToIncludeInFileSystem="@(WasmFilesToIncludeInFileSystem)" IcuDataFileName="$(WasmIcuDataFileName)" RemoteSources="@(WasmRemoteSources)" ExtraFilesToDeploy="@(WasmExtraFilesToDeploy)" ExtraConfig="@(WasmExtraConfig)" NativeAssets="@(WasmNativeAsset)" DebugLevel="$(WasmDebugLevel)"> <Output TaskParameter="FileWrites" ItemName="FileWrites" /> </WasmAppBuilder> <CallTarget Targets="_GenerateRunV8Script" Condition="'$(WasmGenerateRunV8Script)' == 'true'" /> <WriteLinesToFile File="$(WasmAppDir)\.stamp" Lines="" Overwrite="true" /> </Target> <Target Name="_GenerateRunV8Script"> <PropertyGroup> <WasmRunV8ScriptPath Condition="'$(WasmRunV8ScriptPath)' == ''">$(WasmAppDir)run-v8.sh</WasmRunV8ScriptPath> <_WasmMainJSFileName>$([System.IO.Path]::GetFileName('$(WasmMainJSPath)'))</_WasmMainJSFileName> </PropertyGroup> <Error Condition="'$(WasmMainAssemblyFileName)' == ''" Text="%24(WasmMainAssemblyFileName) property needs to be set for generating $(WasmRunV8ScriptPath)." /> <WriteLinesToFile File="$(WasmRunV8ScriptPath)" Lines="v8 --expose_wasm $(_WasmMainJSFileName) -- ${RUNTIME_ARGS} --run $(WasmMainAssemblyFileName) $*" Overwrite="true"> </WriteLinesToFile> <ItemGroup> <FileWrites Include="$(WasmRunV8ScriptPath)" /> </ItemGroup> <Exec Condition="'$(OS)' != 'Windows_NT'" Command="chmod a+x $(WasmRunV8ScriptPath)" /> </Target> <Target Name="_WasmResolveReferences" Condition="'$(WasmResolveAssembliesBeforeBuild)' == 'true'"> <WasmLoadAssembliesAndReferences Assemblies="@(_WasmAssembliesInternal)" AssemblySearchPaths="@(WasmAssemblySearchPaths)" SkipMissingAssemblies="$(WasmSkipMissingAssemblies)"> <Output TaskParameter="ReferencedAssemblies" ItemName="_TmpWasmAssemblies" /> </WasmLoadAssembliesAndReferences> <ItemGroup> <_WasmAssembliesInternal Remove="@(_WasmAssembliesInternal)" /> <_WasmAssembliesInternal Include="@(_TmpWasmAssemblies)" /> </ItemGroup> </Target> <Target Name="_AfterWasmBuildApp"> <ItemGroup> <WasmAssembliesFinal Include="@(_WasmAssembliesInternal)" LlvmBitCodeFile="" /> </ItemGroup> </Target> </Project>
1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/mono/wasm/debugger/tests/debugger-test/debugger-test.csproj
<Project Sdk="Microsoft.NET.Sdk" DefaultTargets="WasmBuildApp"> <PropertyGroup> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <NoWarn>219</NoWarn> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> <RunAnalyzers>false</RunAnalyzers> <WasmBuildAppDependsOn>PrepareForWasmBuildApp;$(WasmBuildAppDependsOn)</WasmBuildAppDependsOn> <WasmGenerateAppBundle>true</WasmGenerateAppBundle> <OutputType>library</OutputType> </PropertyGroup> <ItemGroup> <WasmExtraFilesToDeploy Include="debugger-driver.html" /> <WasmExtraFilesToDeploy Include="non-wasm-page.html" /> <WasmExtraFilesToDeploy Include="wasm-page-without-assets.html" /> <WasmExtraFilesToDeploy Include="other.js" /> <WasmExtraFilesToDeploy Include="weather.json" /> <!-- We want to bundle these assemblies, so build them first --> <ProjectReference Include="..\lazy-debugger-test\lazy-debugger-test.csproj" Private="true"/> <ProjectReference Include="..\lazy-debugger-test-embedded\lazy-debugger-test-embedded.csproj" Private="true"/> <ProjectReference Include="..\library-dependency-debugger-test1\library-dependency-debugger-test1.csproj" Private="true"/> <ProjectReference Include="..\library-dependency-debugger-test2\library-dependency-debugger-test2.csproj" Private="true"/> <ProjectReference Include="..\debugger-test-with-source-link\debugger-test-with-source-link.csproj" Private="true"/> <ProjectReference Include="..\ApplyUpdateReferencedAssembly\ApplyUpdateReferencedAssembly.csproj" /> <ProjectReference Include="..\debugger-test-with-full-debug-type\debugger-test-with-full-debug-type.csproj" Private="true"/> <ProjectReference Include="..\debugger-test-special-char-in-path-#@\debugger-test-special-char-in-path.csproj" Private="true"/> </ItemGroup> <Target Name="PrepareForWasmBuildApp" DependsOnTargets="Build"> <Error Condition="!Exists('$(MicrosoftNetCoreAppRuntimePackRidDir)native')" Text="Cannot find %24(MicrosoftNetCoreAppRuntimePackRidDir)=$(MicrosoftNetCoreAppRuntimePackRidDir)native. Make sure to set the runtime configuration with %24(RuntimeConfiguration). Current value: $(RuntimeConfiguration)" /> <PropertyGroup> <EnableDefaultWasmAssembliesToBundle>false</EnableDefaultWasmAssembliesToBundle> <WasmAppDir>$(AppDir)</WasmAppDir> <WasmMainJSPath>debugger-main.js</WasmMainJSPath> <!-- like is used on blazor --> <WasmDebugLevel Condition="'$(WasmDebugLevel)'==''">-1</WasmDebugLevel> <WasmResolveAssembliesBeforeBuild>true</WasmResolveAssembliesBeforeBuild> </PropertyGroup> <ItemGroup> <WasmAssembliesToBundle Include="$(OutDir)\$(TargetFileName)" /> <WasmAssembliesToBundle Include="$(OutDir)\debugger-test-with-source-link.dll" /> <WasmAssembliesToBundle Include="$(OutDir)\debugger-test-with-full-debug-type.dll" /> <WasmAssemblySearchPaths Include="$(MicrosoftNetCoreAppRuntimePackRidDir)native"/> <WasmAssemblySearchPaths Include="$(MicrosoftNetCoreAppRuntimePackRidDir)lib\$(NetCoreAppCurrent)"/> <WasmAssembliesToBundle Include="$(OutDir)\debugger-test-special-char-in-path.dll" /> <WasmExtraFilesToDeploy Include="@(ReferenceCopyLocalPaths)" /> </ItemGroup> </Target> <Target Name="PreserveEnCAssembliesFromLinking" Condition="'$(TargetOS)' == 'Browser' and '$(EnableAggressiveTrimming)' == 'true'" BeforeTargets="ConfigureTrimming"> <ItemGroup> <!-- Don't modify EnC test assemblies --> <TrimmerRootAssembly Condition="$([System.String]::Copy('%(ResolvedFileToPublish.FileName)%(ResolvedFileToPublish.Extension)').EndsWith('ApplyUpdateReferencedAssembly.dll'))" Include="%(ResolvedFileToPublish.FullPath)" /> </ItemGroup> </Target> <Target Name="IncludeDeltasInWasmBundle" BeforeTargets="PrepareForWasmBuildApp" Condition="'$(TargetOS)' == 'Browser'"> <ItemGroup> <!-- FIXME: this belongs in eng/testing/tests.wasm.targets --> <!-- FIXME: Can we do something on the Content items in the referenced projects themselves to get this for free? --> <WasmFilesToIncludeInFileSystem Include="@(PublishItemsOutputGroupOutputs)" Condition="$([System.String]::new('%(PublishItemsOutputGroupOutputs.Identity)').EndsWith('.dmeta'))" /> <WasmFilesToIncludeInFileSystem Include="@(PublishItemsOutputGroupOutputs)" Condition="$([System.String]::new('%(PublishItemsOutputGroupOutputs.Identity)').EndsWith('.dil'))" /> <WasmFilesToIncludeInFileSystem Include="@(PublishItemsOutputGroupOutputs)" Condition="$([System.String]::new('%(PublishItemsOutputGroupOutputs.Identity)').EndsWith('.dpdb'))" /> </ItemGroup> </Target> <Import Project="$(MonoProjectRoot)\wasm\build\WasmApp.InTree.targets" /> </Project>
<Project Sdk="Microsoft.NET.Sdk" DefaultTargets="WasmBuildApp"> <PropertyGroup> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <NoWarn>219</NoWarn> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> <RunAnalyzers>false</RunAnalyzers> <WasmBuildAppDependsOn>PrepareForWasmBuildApp;$(WasmBuildAppDependsOn)</WasmBuildAppDependsOn> <WasmGenerateAppBundle>true</WasmGenerateAppBundle> <OutputType>library</OutputType> <WasmEmitSymbolMap>true</WasmEmitSymbolMap> </PropertyGroup> <ItemGroup> <WasmExtraFilesToDeploy Include="debugger-driver.html" /> <WasmExtraFilesToDeploy Include="non-wasm-page.html" /> <WasmExtraFilesToDeploy Include="wasm-page-without-assets.html" /> <WasmExtraFilesToDeploy Include="other.js" /> <WasmExtraFilesToDeploy Include="weather.json" /> <!-- We want to bundle these assemblies, so build them first --> <ProjectReference Include="..\lazy-debugger-test\lazy-debugger-test.csproj" Private="true"/> <ProjectReference Include="..\lazy-debugger-test-embedded\lazy-debugger-test-embedded.csproj" Private="true"/> <ProjectReference Include="..\library-dependency-debugger-test1\library-dependency-debugger-test1.csproj" Private="true"/> <ProjectReference Include="..\library-dependency-debugger-test2\library-dependency-debugger-test2.csproj" Private="true"/> <ProjectReference Include="..\debugger-test-with-source-link\debugger-test-with-source-link.csproj" Private="true"/> <ProjectReference Include="..\ApplyUpdateReferencedAssembly\ApplyUpdateReferencedAssembly.csproj" /> <ProjectReference Include="..\debugger-test-with-full-debug-type\debugger-test-with-full-debug-type.csproj" Private="true"/> <ProjectReference Include="..\debugger-test-special-char-in-path-#@\debugger-test-special-char-in-path.csproj" Private="true"/> </ItemGroup> <Target Name="PrepareForWasmBuildApp" DependsOnTargets="Build"> <Error Condition="!Exists('$(MicrosoftNetCoreAppRuntimePackRidDir)native')" Text="Cannot find %24(MicrosoftNetCoreAppRuntimePackRidDir)=$(MicrosoftNetCoreAppRuntimePackRidDir)native. Make sure to set the runtime configuration with %24(RuntimeConfiguration). Current value: $(RuntimeConfiguration)" /> <PropertyGroup> <EnableDefaultWasmAssembliesToBundle>false</EnableDefaultWasmAssembliesToBundle> <WasmAppDir>$(AppDir)</WasmAppDir> <WasmMainJSPath>debugger-main.js</WasmMainJSPath> <!-- like is used on blazor --> <WasmDebugLevel Condition="'$(WasmDebugLevel)'==''">-1</WasmDebugLevel> <WasmResolveAssembliesBeforeBuild>true</WasmResolveAssembliesBeforeBuild> </PropertyGroup> <ItemGroup> <WasmAssembliesToBundle Include="$(OutDir)\$(TargetFileName)" /> <WasmAssembliesToBundle Include="$(OutDir)\debugger-test-with-source-link.dll" /> <WasmAssembliesToBundle Include="$(OutDir)\debugger-test-with-full-debug-type.dll" /> <WasmAssemblySearchPaths Include="$(MicrosoftNetCoreAppRuntimePackRidDir)native"/> <WasmAssemblySearchPaths Include="$(MicrosoftNetCoreAppRuntimePackRidDir)lib\$(NetCoreAppCurrent)"/> <WasmAssembliesToBundle Include="$(OutDir)\debugger-test-special-char-in-path.dll" /> <WasmExtraFilesToDeploy Include="@(ReferenceCopyLocalPaths)" /> </ItemGroup> </Target> <Target Name="PreserveEnCAssembliesFromLinking" Condition="'$(TargetOS)' == 'Browser' and '$(EnableAggressiveTrimming)' == 'true'" BeforeTargets="ConfigureTrimming"> <ItemGroup> <!-- Don't modify EnC test assemblies --> <TrimmerRootAssembly Condition="$([System.String]::Copy('%(ResolvedFileToPublish.FileName)%(ResolvedFileToPublish.Extension)').EndsWith('ApplyUpdateReferencedAssembly.dll'))" Include="%(ResolvedFileToPublish.FullPath)" /> </ItemGroup> </Target> <Target Name="IncludeDeltasInWasmBundle" BeforeTargets="PrepareForWasmBuildApp" Condition="'$(TargetOS)' == 'Browser'"> <ItemGroup> <!-- FIXME: this belongs in eng/testing/tests.wasm.targets --> <!-- FIXME: Can we do something on the Content items in the referenced projects themselves to get this for free? --> <WasmFilesToIncludeInFileSystem Include="@(PublishItemsOutputGroupOutputs)" Condition="$([System.String]::new('%(PublishItemsOutputGroupOutputs.Identity)').EndsWith('.dmeta'))" /> <WasmFilesToIncludeInFileSystem Include="@(PublishItemsOutputGroupOutputs)" Condition="$([System.String]::new('%(PublishItemsOutputGroupOutputs.Identity)').EndsWith('.dil'))" /> <WasmFilesToIncludeInFileSystem Include="@(PublishItemsOutputGroupOutputs)" Condition="$([System.String]::new('%(PublishItemsOutputGroupOutputs.Identity)').EndsWith('.dpdb'))" /> </ItemGroup> </Target> <Import Project="$(MonoProjectRoot)\wasm\build\WasmApp.InTree.targets" /> </Project>
1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/mono/wasm/runtime/debug.ts
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. import { INTERNAL, Module, MONO, runtimeHelpers } from "./imports"; import { toBase64StringImpl } from "./base64"; import cwraps from "./cwraps"; import { VoidPtr, CharPtr } from "./types/emscripten"; const commands_received : any = new Map<number, CommandResponse>(); commands_received.remove = function (key: number) : CommandResponse { const value = this.get(key); this.delete(key); return value;}; let _call_function_res_cache: any = {}; let _next_call_function_res_id = 0; let _debugger_buffer_len = -1; let _debugger_buffer: VoidPtr; export function mono_wasm_runtime_ready(): void { runtimeHelpers.mono_wasm_runtime_is_ready = true; // FIXME: where should this go? _next_call_function_res_id = 0; _call_function_res_cache = {}; _debugger_buffer_len = -1; // DO NOT REMOVE - magic debugger init function if ((<any>globalThis).dotnetDebugger) // eslint-disable-next-line no-debugger debugger; else console.debug("mono_wasm_runtime_ready", "fe00e07a-5519-4dfe-b35a-f867dbaf2e28"); } export function mono_wasm_fire_debugger_agent_message(): void { // eslint-disable-next-line no-debugger debugger; } export function mono_wasm_add_dbg_command_received(res_ok: boolean, id: number, buffer: number, buffer_len: number): void { const assembly_data = new Uint8Array(Module.HEAPU8.buffer, buffer, buffer_len); const base64String = toBase64StringImpl(assembly_data); const buffer_obj = { res_ok, res: { id, value: base64String } }; if (commands_received.has(id)) console.warn("Addind an id that already exists in commands_received"); commands_received.set(id, buffer_obj); } function mono_wasm_malloc_and_set_debug_buffer(command_parameters: string) { if (command_parameters.length > _debugger_buffer_len) { if (_debugger_buffer) Module._free(_debugger_buffer); _debugger_buffer_len = Math.max(command_parameters.length, _debugger_buffer_len, 256); _debugger_buffer = Module._malloc(_debugger_buffer_len); } const byteCharacters = atob(command_parameters); for (let i = 0; i < byteCharacters.length; i++) { Module.HEAPU8[<any>_debugger_buffer + i] = byteCharacters.charCodeAt(i); } } export function mono_wasm_send_dbg_command_with_parms(id: number, command_set: number, command: number, command_parameters: string, length: number, valtype: number, newvalue: number): CommandResponseResult { mono_wasm_malloc_and_set_debug_buffer(command_parameters); cwraps.mono_wasm_send_dbg_command_with_parms(id, command_set, command, _debugger_buffer, length, valtype, newvalue.toString()); const { res_ok, res } = commands_received.remove(id); if (!res_ok) throw new Error("Failed on mono_wasm_invoke_method_debugger_agent_with_parms"); return res; } export function mono_wasm_send_dbg_command(id: number, command_set: number, command: number, command_parameters: string): CommandResponseResult { mono_wasm_malloc_and_set_debug_buffer(command_parameters); cwraps.mono_wasm_send_dbg_command(id, command_set, command, _debugger_buffer, command_parameters.length); const { res_ok, res } = commands_received.remove(id); if (!res_ok) throw new Error("Failed on mono_wasm_send_dbg_command"); return res; } export function mono_wasm_get_dbg_command_info(): CommandResponseResult { const { res_ok, res } = commands_received.remove(0); if (!res_ok) throw new Error("Failed on mono_wasm_get_dbg_command_info"); return res; } export function mono_wasm_debugger_resume(): void { //nothing } export function mono_wasm_detach_debugger(): void { cwraps.mono_wasm_set_is_debugger_attached(false); } export function mono_wasm_change_debugger_log_level(level: number): void { cwraps.mono_wasm_change_debugger_log_level(level); } /** * Raises an event for the debug proxy */ export function mono_wasm_raise_debug_event(event: WasmEvent, args = {}): void { if (typeof event !== "object") throw new Error(`event must be an object, but got ${JSON.stringify(event)}`); if (event.eventName === undefined) throw new Error(`event.eventName is a required parameter, in event: ${JSON.stringify(event)}`); if (typeof args !== "object") throw new Error(`args must be an object, but got ${JSON.stringify(args)}`); console.debug("mono_wasm_debug_event_raised:aef14bca-5519-4dfe-b35a-f867abc123ae", JSON.stringify(event), JSON.stringify(args)); } // Used by the debugger to enumerate loaded dlls and pdbs export function mono_wasm_get_loaded_files(): string[] { cwraps.mono_wasm_set_is_debugger_attached(true); return MONO.loaded_files; } function _create_proxy_from_object_id(objectId: string, details: any) { if (objectId.startsWith("dotnet:array:")) { let ret: Array<any>; if (details.dimensionsDetails === undefined || details.dimensionsDetails.length === 1) { ret = details.items.map((p: any) => p.value); return ret; } } const proxy: any = {}; Object.keys(details).forEach(p => { const prop = details[p]; if (prop.get !== undefined) { Object.defineProperty(proxy, prop.name, { get() { return mono_wasm_send_dbg_command(prop.get.id, prop.get.commandSet, prop.get.command, prop.get.buffer); }, set: function (newValue) { mono_wasm_send_dbg_command_with_parms(prop.set.id, prop.set.commandSet, prop.set.command, prop.set.buffer, prop.set.length, prop.set.valtype, newValue); return true; } } ); } else if (prop.set !== undefined) { Object.defineProperty(proxy, prop.name, { get() { return prop.value; }, set: function (newValue) { mono_wasm_send_dbg_command_with_parms(prop.set.id, prop.set.commandSet, prop.set.command, prop.set.buffer, prop.set.length, prop.set.valtype, newValue); return true; } } ); } else { proxy[prop.name] = prop.value; } }); return proxy; } export function mono_wasm_call_function_on(request: CallRequest): CFOResponse { if (request.arguments != undefined && !Array.isArray(request.arguments)) throw new Error(`"arguments" should be an array, but was ${request.arguments}`); const objId = request.objectId; const details = request.details; let proxy: any = {}; if (objId.startsWith("dotnet:cfo_res:")) { if (objId in _call_function_res_cache) proxy = _call_function_res_cache[objId]; else throw new Error(`Unknown object id ${objId}`); } else { proxy = _create_proxy_from_object_id(objId, details); } const fn_args = request.arguments != undefined ? request.arguments.map(a => JSON.stringify(a.value)) : []; const fn_body_template = `const fn = ${request.functionDeclaration}; return fn.apply(proxy, [${fn_args}]);`; const fn_defn = new Function("proxy", fn_body_template); const fn_res = fn_defn(proxy); if (fn_res === undefined) return { type: "undefined" }; if (Object(fn_res) !== fn_res) { if (typeof (fn_res) == "object" && fn_res == null) return { type: typeof (fn_res), subtype: `${fn_res}`, value: null }; return { type: typeof (fn_res), description: `${fn_res}`, value: `${fn_res}` }; } if (request.returnByValue && fn_res.subtype == undefined) return { type: "object", value: fn_res }; if (Object.getPrototypeOf(fn_res) == Array.prototype) { const fn_res_id = _cache_call_function_res(fn_res); return { type: "object", subtype: "array", className: "Array", description: `Array(${fn_res.length})`, objectId: fn_res_id }; } if (fn_res.value !== undefined || fn_res.subtype !== undefined) { return fn_res; } if (fn_res == proxy) return { type: "object", className: "Object", description: "Object", objectId: objId }; const fn_res_id = _cache_call_function_res(fn_res); return { type: "object", className: "Object", description: "Object", objectId: fn_res_id }; } function _get_cfo_res_details(objectId: string, args: any): ValueAsJsonString { if (!(objectId in _call_function_res_cache)) throw new Error(`Could not find any object with id ${objectId}`); const real_obj = _call_function_res_cache[objectId]; const descriptors = Object.getOwnPropertyDescriptors(real_obj); if (args.accessorPropertiesOnly) { Object.keys(descriptors).forEach(k => { if (descriptors[k].get === undefined) Reflect.deleteProperty(descriptors, k); }); } const res_details: any[] = []; Object.keys(descriptors).forEach(k => { let new_obj; const prop_desc = descriptors[k]; if (typeof prop_desc.value == "object") { // convert `{value: { type='object', ... }}` // to `{ name: 'foo', value: { type='object', ... }} new_obj = Object.assign({ name: k }, prop_desc); } else if (prop_desc.value !== undefined) { // This is needed for values that were not added by us, // thus are like { value: 5 } // instead of { value: { type = 'number', value: 5 }} // // This can happen, for eg., when `length` gets added for arrays // or `__proto__`. new_obj = { name: k, // merge/add `type` and `description` to `d.value` value: Object.assign({ type: (typeof prop_desc.value), description: "" + prop_desc.value }, prop_desc) }; } else if (prop_desc.get !== undefined) { // The real_obj has the actual getter. We are just returning a placeholder // If the caller tries to run function on the cfo_res object, // that accesses this property, then it would be run on `real_obj`, // which *has* the original getter new_obj = { name: k, get: { className: "Function", description: `get ${k} () {}`, type: "function" } }; } else { new_obj = { name: k, value: { type: "symbol", value: "<Unknown>", description: "<Unknown>" } }; } res_details.push(new_obj); }); return { __value_as_json_string__: JSON.stringify(res_details) }; } type ValueAsJsonString = { __value_as_json_string__: string; } export function mono_wasm_get_details(objectId: string, args = {}): ValueAsJsonString { return _get_cfo_res_details(`dotnet:cfo_res:${objectId}`, args); } function _cache_call_function_res(obj: any) { const id = `dotnet:cfo_res:${_next_call_function_res_id++}`; _call_function_res_cache[id] = obj; return id; } export function mono_wasm_release_object(objectId: string): void { if (objectId in _call_function_res_cache) delete _call_function_res_cache[objectId]; } export function mono_wasm_debugger_log(level: number, message_ptr: CharPtr): void { const message = Module.UTF8ToString(message_ptr); if (INTERNAL["logging"] && typeof INTERNAL.logging["debugger"] === "function") { INTERNAL.logging.debugger(level, message); return; } console.debug(`Debugger.Debug: ${message}`); } export function mono_wasm_trace_logger(log_domain_ptr: CharPtr, log_level_ptr: CharPtr, message_ptr: CharPtr, fatal: number, user_data: VoidPtr): void { const message = Module.UTF8ToString(message_ptr); const isFatal = !!fatal; const domain = Module.UTF8ToString(log_domain_ptr); // is this always Mono? const dataPtr = user_data; const log_level = Module.UTF8ToString(log_level_ptr); if (INTERNAL["logging"] && typeof INTERNAL.logging["trace"] === "function") { INTERNAL.logging.trace(domain, log_level, message, isFatal, dataPtr); return; } if (isFatal) console.trace(message); switch (log_level) { case "critical": case "error": console.error(message); break; case "warning": console.warn(message); break; case "message": console.log(message); break; case "info": console.info(message); break; case "debug": console.debug(message); break; default: console.log(message); break; } } type CallDetails = { value: string } type CallArgs = { value: string } type CallRequest = { arguments: undefined | Array<CallArgs>, objectId: string, details: CallDetails[], functionDeclaration: string returnByValue: boolean, } type WasmEvent = { eventName: string, // - name of the event being raised [i: string]: any, // - arguments for the event itself } type CommandResponseResult = { id: number, value: string } type CommandResponse = { res_ok: boolean, res: CommandResponseResult }; type CFOResponse = { type: string, subtype?: string, value?: string | null, className?: string, description?: string, objectId?: string }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. import { INTERNAL, Module, MONO, runtimeHelpers } from "./imports"; import { toBase64StringImpl } from "./base64"; import cwraps from "./cwraps"; import { VoidPtr, CharPtr } from "./types/emscripten"; const commands_received : any = new Map<number, CommandResponse>(); const wasm_func_map = new Map<number, string>(); commands_received.remove = function (key: number) : CommandResponse { const value = this.get(key); this.delete(key); return value;}; let _call_function_res_cache: any = {}; let _next_call_function_res_id = 0; let _debugger_buffer_len = -1; let _debugger_buffer: VoidPtr; const regexes:any[] = []; // V8 // at <anonymous>:wasm-function[1900]:0x83f63 // at dlfree (<anonymous>:wasm-function[18739]:0x2328ef) regexes.push(/at (?<replaceSection>[^:()]+:wasm-function\[(?<funcNum>\d+)\]:0x[a-fA-F\d]+)((?![^)a-fA-F\d])|$)/); //# 5: WASM [009712b2], function #111 (''), pc=0x7c16595c973 (+0x53), pos=38740 (+11) regexes.push(/(?:WASM \[[\da-zA-Z]+\], (?<replaceSection>function #(?<funcNum>[\d]+) \(''\)))/); //# chrome //# at http://127.0.0.1:63817/dotnet.wasm:wasm-function[8963]:0x1e23f4 regexes.push(/(?<replaceSection>[a-z]+:\/\/[^ )]*:wasm-function\[(?<funcNum>\d+)\]:0x[a-fA-F\d]+)/); //# <?>.wasm-function[8962] regexes.push(/(?<replaceSection><[^ >]+>[.:]wasm-function\[(?<funcNum>[0-9]+)\])/); export function mono_wasm_runtime_ready(): void { runtimeHelpers.mono_wasm_runtime_is_ready = true; // FIXME: where should this go? _next_call_function_res_id = 0; _call_function_res_cache = {}; _debugger_buffer_len = -1; // DO NOT REMOVE - magic debugger init function if ((<any>globalThis).dotnetDebugger) // eslint-disable-next-line no-debugger debugger; else console.debug("mono_wasm_runtime_ready", "fe00e07a-5519-4dfe-b35a-f867dbaf2e28"); _readSymbolMapFile("dotnet.js.symbols"); } export function mono_wasm_fire_debugger_agent_message(): void { // eslint-disable-next-line no-debugger debugger; } export function mono_wasm_add_dbg_command_received(res_ok: boolean, id: number, buffer: number, buffer_len: number): void { const assembly_data = new Uint8Array(Module.HEAPU8.buffer, buffer, buffer_len); const base64String = toBase64StringImpl(assembly_data); const buffer_obj = { res_ok, res: { id, value: base64String } }; if (commands_received.has(id)) console.warn("Addind an id that already exists in commands_received"); commands_received.set(id, buffer_obj); } function mono_wasm_malloc_and_set_debug_buffer(command_parameters: string) { if (command_parameters.length > _debugger_buffer_len) { if (_debugger_buffer) Module._free(_debugger_buffer); _debugger_buffer_len = Math.max(command_parameters.length, _debugger_buffer_len, 256); _debugger_buffer = Module._malloc(_debugger_buffer_len); } const byteCharacters = atob(command_parameters); for (let i = 0; i < byteCharacters.length; i++) { Module.HEAPU8[<any>_debugger_buffer + i] = byteCharacters.charCodeAt(i); } } export function mono_wasm_send_dbg_command_with_parms(id: number, command_set: number, command: number, command_parameters: string, length: number, valtype: number, newvalue: number): CommandResponseResult { mono_wasm_malloc_and_set_debug_buffer(command_parameters); cwraps.mono_wasm_send_dbg_command_with_parms(id, command_set, command, _debugger_buffer, length, valtype, newvalue.toString()); const { res_ok, res } = commands_received.remove(id); if (!res_ok) throw new Error("Failed on mono_wasm_invoke_method_debugger_agent_with_parms"); return res; } export function mono_wasm_send_dbg_command(id: number, command_set: number, command: number, command_parameters: string): CommandResponseResult { mono_wasm_malloc_and_set_debug_buffer(command_parameters); cwraps.mono_wasm_send_dbg_command(id, command_set, command, _debugger_buffer, command_parameters.length); const { res_ok, res } = commands_received.remove(id); if (!res_ok) throw new Error("Failed on mono_wasm_send_dbg_command"); return res; } export function mono_wasm_get_dbg_command_info(): CommandResponseResult { const { res_ok, res } = commands_received.remove(0); if (!res_ok) throw new Error("Failed on mono_wasm_get_dbg_command_info"); return res; } export function mono_wasm_debugger_resume(): void { //nothing } export function mono_wasm_detach_debugger(): void { cwraps.mono_wasm_set_is_debugger_attached(false); } export function mono_wasm_change_debugger_log_level(level: number): void { cwraps.mono_wasm_change_debugger_log_level(level); } /** * Raises an event for the debug proxy */ export function mono_wasm_raise_debug_event(event: WasmEvent, args = {}): void { if (typeof event !== "object") throw new Error(`event must be an object, but got ${JSON.stringify(event)}`); if (event.eventName === undefined) throw new Error(`event.eventName is a required parameter, in event: ${JSON.stringify(event)}`); if (typeof args !== "object") throw new Error(`args must be an object, but got ${JSON.stringify(args)}`); console.debug("mono_wasm_debug_event_raised:aef14bca-5519-4dfe-b35a-f867abc123ae", JSON.stringify(event), JSON.stringify(args)); } // Used by the debugger to enumerate loaded dlls and pdbs export function mono_wasm_get_loaded_files(): string[] { cwraps.mono_wasm_set_is_debugger_attached(true); return MONO.loaded_files; } function _create_proxy_from_object_id(objectId: string, details: any) { if (objectId.startsWith("dotnet:array:")) { let ret: Array<any>; if (details.dimensionsDetails === undefined || details.dimensionsDetails.length === 1) { ret = details.items.map((p: any) => p.value); return ret; } } const proxy: any = {}; Object.keys(details).forEach(p => { const prop = details[p]; if (prop.get !== undefined) { Object.defineProperty(proxy, prop.name, { get() { return mono_wasm_send_dbg_command(prop.get.id, prop.get.commandSet, prop.get.command, prop.get.buffer); }, set: function (newValue) { mono_wasm_send_dbg_command_with_parms(prop.set.id, prop.set.commandSet, prop.set.command, prop.set.buffer, prop.set.length, prop.set.valtype, newValue); return true; } } ); } else if (prop.set !== undefined) { Object.defineProperty(proxy, prop.name, { get() { return prop.value; }, set: function (newValue) { mono_wasm_send_dbg_command_with_parms(prop.set.id, prop.set.commandSet, prop.set.command, prop.set.buffer, prop.set.length, prop.set.valtype, newValue); return true; } } ); } else { proxy[prop.name] = prop.value; } }); return proxy; } export function mono_wasm_call_function_on(request: CallRequest): CFOResponse { if (request.arguments != undefined && !Array.isArray(request.arguments)) throw new Error(`"arguments" should be an array, but was ${request.arguments}`); const objId = request.objectId; const details = request.details; let proxy: any = {}; if (objId.startsWith("dotnet:cfo_res:")) { if (objId in _call_function_res_cache) proxy = _call_function_res_cache[objId]; else throw new Error(`Unknown object id ${objId}`); } else { proxy = _create_proxy_from_object_id(objId, details); } const fn_args = request.arguments != undefined ? request.arguments.map(a => JSON.stringify(a.value)) : []; const fn_body_template = `const fn = ${request.functionDeclaration}; return fn.apply(proxy, [${fn_args}]);`; const fn_defn = new Function("proxy", fn_body_template); const fn_res = fn_defn(proxy); if (fn_res === undefined) return { type: "undefined" }; if (Object(fn_res) !== fn_res) { if (typeof (fn_res) == "object" && fn_res == null) return { type: typeof (fn_res), subtype: `${fn_res}`, value: null }; return { type: typeof (fn_res), description: `${fn_res}`, value: `${fn_res}` }; } if (request.returnByValue && fn_res.subtype == undefined) return { type: "object", value: fn_res }; if (Object.getPrototypeOf(fn_res) == Array.prototype) { const fn_res_id = _cache_call_function_res(fn_res); return { type: "object", subtype: "array", className: "Array", description: `Array(${fn_res.length})`, objectId: fn_res_id }; } if (fn_res.value !== undefined || fn_res.subtype !== undefined) { return fn_res; } if (fn_res == proxy) return { type: "object", className: "Object", description: "Object", objectId: objId }; const fn_res_id = _cache_call_function_res(fn_res); return { type: "object", className: "Object", description: "Object", objectId: fn_res_id }; } function _get_cfo_res_details(objectId: string, args: any): ValueAsJsonString { if (!(objectId in _call_function_res_cache)) throw new Error(`Could not find any object with id ${objectId}`); const real_obj = _call_function_res_cache[objectId]; const descriptors = Object.getOwnPropertyDescriptors(real_obj); if (args.accessorPropertiesOnly) { Object.keys(descriptors).forEach(k => { if (descriptors[k].get === undefined) Reflect.deleteProperty(descriptors, k); }); } const res_details: any[] = []; Object.keys(descriptors).forEach(k => { let new_obj; const prop_desc = descriptors[k]; if (typeof prop_desc.value == "object") { // convert `{value: { type='object', ... }}` // to `{ name: 'foo', value: { type='object', ... }} new_obj = Object.assign({ name: k }, prop_desc); } else if (prop_desc.value !== undefined) { // This is needed for values that were not added by us, // thus are like { value: 5 } // instead of { value: { type = 'number', value: 5 }} // // This can happen, for eg., when `length` gets added for arrays // or `__proto__`. new_obj = { name: k, // merge/add `type` and `description` to `d.value` value: Object.assign({ type: (typeof prop_desc.value), description: "" + prop_desc.value }, prop_desc) }; } else if (prop_desc.get !== undefined) { // The real_obj has the actual getter. We are just returning a placeholder // If the caller tries to run function on the cfo_res object, // that accesses this property, then it would be run on `real_obj`, // which *has* the original getter new_obj = { name: k, get: { className: "Function", description: `get ${k} () {}`, type: "function" } }; } else { new_obj = { name: k, value: { type: "symbol", value: "<Unknown>", description: "<Unknown>" } }; } res_details.push(new_obj); }); return { __value_as_json_string__: JSON.stringify(res_details) }; } type ValueAsJsonString = { __value_as_json_string__: string; } export function mono_wasm_get_details(objectId: string, args = {}): ValueAsJsonString { return _get_cfo_res_details(`dotnet:cfo_res:${objectId}`, args); } function _cache_call_function_res(obj: any) { const id = `dotnet:cfo_res:${_next_call_function_res_id++}`; _call_function_res_cache[id] = obj; return id; } export function mono_wasm_release_object(objectId: string): void { if (objectId in _call_function_res_cache) delete _call_function_res_cache[objectId]; } export function mono_wasm_debugger_log(level: number, message_ptr: CharPtr): void { const message = Module.UTF8ToString(message_ptr); if (INTERNAL["logging"] && typeof INTERNAL.logging["debugger"] === "function") { INTERNAL.logging.debugger(level, message); return; } console.debug(`Debugger.Debug: ${message}`); } function _readSymbolMapFile(filename: string): void { try { const res = Module.FS_readFile(filename, {flags: "r", encoding: "utf8"}); res.split(/[\r\n]/).forEach((line: string) => { const parts:string[] = line.split(/:/); if (parts.length < 2) return; parts[1] = parts.splice(1).join(":"); wasm_func_map.set(Number(parts[0]), parts[1]); }); console.debug(`Loaded ${wasm_func_map.size} symbols`); } catch (error:any) { if (error.errno == 44) // NOENT console.debug(`Could not find symbols file ${filename}. Ignoring.`); else console.log(`Error loading symbol file ${filename}: ${JSON.stringify(error)}`); return; } } export function mono_wasm_symbolicate_string(message: string): string { try { if (wasm_func_map.size == 0) return message; const origMessage = message; for (let i = 0; i < regexes.length; i ++) { const newRaw = message.replace(new RegExp(regexes[i], "g"), (substring, ...args) => { const groups = args.find(arg => { return typeof(arg) == "object" && arg.replaceSection !== undefined; }); if (groups === undefined) return substring; const funcNum = groups.funcNum; const replaceSection = groups.replaceSection; const name = wasm_func_map.get(Number(funcNum)); if (name === undefined) return substring; return substring.replace(replaceSection, `${name} (${replaceSection})`); }); if (newRaw !== origMessage) return newRaw; } return origMessage; } catch (error) { console.debug(`failed to symbolicate: ${error}`); return message; } } export function mono_wasm_stringify_as_error_with_stack(err: Error | string): string { let errObj: any = err; if (!(err instanceof Error)) errObj = new Error(err); // Error return mono_wasm_symbolicate_string(errObj.stack); } export function mono_wasm_trace_logger(log_domain_ptr: CharPtr, log_level_ptr: CharPtr, message_ptr: CharPtr, fatal: number, user_data: VoidPtr): void { const origMessage = Module.UTF8ToString(message_ptr); const isFatal = !!fatal; const domain = Module.UTF8ToString(log_domain_ptr); const dataPtr = user_data; const log_level = Module.UTF8ToString(log_level_ptr); const message = `[MONO] ${origMessage}`; if (INTERNAL["logging"] && typeof INTERNAL.logging["trace"] === "function") { INTERNAL.logging.trace(domain, log_level, message, isFatal, dataPtr); return; } switch (log_level) { case "critical": case "error": console.error(mono_wasm_stringify_as_error_with_stack(message)); break; case "warning": console.warn(message); break; case "message": console.log(message); break; case "info": console.info(message); break; case "debug": console.debug(message); break; default: console.log(message); break; } } type CallDetails = { value: string } type CallArgs = { value: string } type CallRequest = { arguments: undefined | Array<CallArgs>, objectId: string, details: CallDetails[], functionDeclaration: string returnByValue: boolean, } type WasmEvent = { eventName: string, // - name of the event being raised [i: string]: any, // - arguments for the event itself } type CommandResponseResult = { id: number, value: string } type CommandResponse = { res_ok: boolean, res: CommandResponseResult }; type CFOResponse = { type: string, subtype?: string, value?: string | null, className?: string, description?: string, objectId?: string }
1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/mono/wasm/runtime/dotnet.d.ts
//! Licensed to the .NET Foundation under one or more agreements. //! The .NET Foundation licenses this file to you under the MIT license. //! //! This is generated file, see src/mono/wasm/runtime/rollup.config.js //! This is not considered public API with backward compatibility guarantees. declare interface ManagedPointer { __brandManagedPointer: "ManagedPointer"; } declare interface NativePointer { __brandNativePointer: "NativePointer"; } declare interface VoidPtr extends NativePointer { __brand: "VoidPtr"; } declare interface CharPtr extends NativePointer { __brand: "CharPtr"; } declare interface Int32Ptr extends NativePointer { __brand: "Int32Ptr"; } declare interface EmscriptenModule { HEAP8: Int8Array; HEAP16: Int16Array; HEAP32: Int32Array; HEAPU8: Uint8Array; HEAPU16: Uint16Array; HEAPU32: Uint32Array; HEAPF32: Float32Array; HEAPF64: Float64Array; _malloc(size: number): VoidPtr; _free(ptr: VoidPtr): void; print(message: string): void; printErr(message: string): void; ccall<T>(ident: string, returnType?: string | null, argTypes?: string[], args?: any[], opts?: any): T; cwrap<T extends Function>(ident: string, returnType: string, argTypes?: string[], opts?: any): T; cwrap<T extends Function>(ident: string, ...args: any[]): T; setValue(ptr: VoidPtr, value: number, type: string, noSafe?: number | boolean): void; setValue(ptr: Int32Ptr, value: number, type: string, noSafe?: number | boolean): void; getValue(ptr: number, type: string, noSafe?: number | boolean): number; UTF8ToString(ptr: CharPtr, maxBytesToRead?: number): string; UTF8ArrayToString(u8Array: Uint8Array, idx?: number, maxBytesToRead?: number): string; FS_createPath(parent: string, path: string, canRead?: boolean, canWrite?: boolean): string; FS_createDataFile(parent: string, name: string, data: TypedArray, canRead: boolean, canWrite: boolean, canOwn?: boolean): string; removeRunDependency(id: string): void; addRunDependency(id: string): void; ready: Promise<unknown>; preInit?: (() => any)[]; preRun?: (() => any)[]; postRun?: (() => any)[]; onAbort?: { (error: any): void; }; onRuntimeInitialized?: () => any; instantiateWasm: (imports: any, successCallback: Function) => any; } declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array; /** * Allocates a block of memory that can safely contain pointers into the managed heap. * The result object has get(index) and set(index, value) methods that can be used to retrieve and store managed pointers. * Once you are done using the root buffer, you must call its release() method. * For small numbers of roots, it is preferable to use the mono_wasm_new_root and mono_wasm_new_roots APIs instead. */ declare function mono_wasm_new_root_buffer(capacity: number, name?: string): WasmRootBuffer; /** * Allocates temporary storage for a pointer into the managed heap. * Pointers stored here will be visible to the GC, ensuring that the object they point to aren't moved or collected. * If you already have a managed pointer you can pass it as an argument to initialize the temporary storage. * The result object has get() and set(value) methods, along with a .value property. * When you are done using the root you must call its .release() method. */ declare function mono_wasm_new_root<T extends ManagedPointer | NativePointer>(value?: T | undefined): WasmRoot<T>; /** * Releases 1 or more root or root buffer objects. * Multiple objects may be passed on the argument list. * 'undefined' may be passed as an argument so it is safe to call this method from finally blocks * even if you are not sure all of your roots have been created yet. * @param {... WasmRoot} roots */ declare function mono_wasm_release_roots(...args: WasmRoot<any>[]): void; declare class WasmRootBuffer { private __count; private length; private __offset; private __offset32; private __handle; private __ownsAllocation; constructor(offset: VoidPtr, capacity: number, ownsAllocation: boolean, name?: string); _throw_index_out_of_range(): void; _check_in_range(index: number): void; get_address(index: number): NativePointer; get_address_32(index: number): number; get(index: number): ManagedPointer; set(index: number, value: ManagedPointer): ManagedPointer; _unsafe_get(index: number): number; _unsafe_set(index: number, value: ManagedPointer | NativePointer): void; clear(): void; release(): void; toString(): string; } interface WasmRoot<T extends ManagedPointer | NativePointer> { get_address(): NativePointer; get_address_32(): number; get(): T; set(value: T): T; get value(): T; set value(value: T); valueOf(): T; clear(): void; release(): void; toString(): string; } interface MonoObject extends ManagedPointer { __brandMonoObject: "MonoObject"; } interface MonoString extends MonoObject { __brand: "MonoString"; } interface MonoArray extends MonoObject { __brand: "MonoArray"; } declare type MonoConfig = { isError: false; assembly_root: string; assets: AllAssetEntryTypes[]; debug_level?: number; enable_debugging?: number; globalization_mode: GlobalizationMode; diagnostic_tracing?: boolean; remote_sources?: string[]; environment_variables?: { [i: string]: string; }; runtime_options?: string[]; aot_profiler_options?: AOTProfilerOptions; coverage_profiler_options?: CoverageProfilerOptions; ignore_pdb_load_errors?: boolean; }; declare type MonoConfigError = { isError: true; message: string; error: any; }; declare type AllAssetEntryTypes = AssetEntry | AssemblyEntry | SatelliteAssemblyEntry | VfsEntry | IcuData; declare type AssetEntry = { name: string; behavior: AssetBehaviours; virtual_path?: string; culture?: string; load_remote?: boolean; is_optional?: boolean; buffer?: ArrayBuffer; }; interface AssemblyEntry extends AssetEntry { name: "assembly"; } interface SatelliteAssemblyEntry extends AssetEntry { name: "resource"; culture: string; } interface VfsEntry extends AssetEntry { name: "vfs"; virtual_path: string; } interface IcuData extends AssetEntry { name: "icu"; load_remote: boolean; } declare const enum AssetBehaviours { Resource = "resource", Assembly = "assembly", Heap = "heap", ICU = "icu", VFS = "vfs" } declare const enum GlobalizationMode { ICU = "icu", INVARIANT = "invariant", AUTO = "auto" } declare type AOTProfilerOptions = { write_at?: string; send_to?: string; }; declare type CoverageProfilerOptions = { write_at?: string; send_to?: string; }; declare type DotnetModuleConfig = { disableDotnet6Compatibility?: boolean; config?: MonoConfig | MonoConfigError; configSrc?: string; onConfigLoaded?: (config: MonoConfig) => Promise<void>; onDotnetReady?: () => void; imports?: DotnetModuleConfigImports; } & Partial<EmscriptenModule>; declare type DotnetModuleConfigImports = { require?: (name: string) => any; fetch?: (url: string) => Promise<Response>; fs?: { promises?: { readFile?: (path: string) => Promise<string | Buffer>; }; readFileSync?: (path: string, options: any | undefined) => string; }; crypto?: { randomBytes?: (size: number) => Buffer; }; ws?: WebSocket & { Server: any; }; path?: { normalize?: (path: string) => string; dirname?: (path: string) => string; }; url?: any; }; declare function mono_wasm_runtime_ready(): void; declare function mono_wasm_setenv(name: string, value: string): void; declare function mono_load_runtime_and_bcl_args(config: MonoConfig | MonoConfigError | undefined): Promise<void>; declare function mono_wasm_load_data_archive(data: Uint8Array, prefix: string): boolean; /** * Loads the mono config file (typically called mono-config.json) asynchroniously * Note: the run dependencies are so emsdk actually awaits it in order. * * @param {string} configFilePath - relative path to the config file * @throws Will throw an error if the config file loading fails */ declare function mono_wasm_load_config(configFilePath: string): Promise<void>; declare function mono_wasm_load_icu_data(offset: VoidPtr): boolean; declare function conv_string(mono_obj: MonoString): string | null; declare function js_string_to_mono_string(string: string): MonoString; declare function js_to_mono_obj(js_obj: any): MonoObject; declare function js_typed_array_to_array(js_obj: any): MonoArray; declare function unbox_mono_obj(mono_obj: MonoObject): any; declare function mono_array_to_js_array(mono_array: MonoArray): any[] | null; declare function mono_bind_static_method(fqn: string, signature?: string): Function; declare function mono_call_assembly_entry_point(assembly: string, args?: any[], signature?: string): number; declare function mono_wasm_load_bytes_into_heap(bytes: Uint8Array): VoidPtr; declare type _MemOffset = number | VoidPtr | NativePointer; declare type _NumberOrPointer = number | VoidPtr | NativePointer | ManagedPointer; declare function setU8(offset: _MemOffset, value: number): void; declare function setU16(offset: _MemOffset, value: number): void; declare function setU32(offset: _MemOffset, value: _NumberOrPointer): void; declare function setI8(offset: _MemOffset, value: number): void; declare function setI16(offset: _MemOffset, value: number): void; declare function setI32(offset: _MemOffset, value: _NumberOrPointer): void; declare function setI64(offset: _MemOffset, value: number): void; declare function setF32(offset: _MemOffset, value: number): void; declare function setF64(offset: _MemOffset, value: number): void; declare function getU8(offset: _MemOffset): number; declare function getU16(offset: _MemOffset): number; declare function getU32(offset: _MemOffset): number; declare function getI8(offset: _MemOffset): number; declare function getI16(offset: _MemOffset): number; declare function getI32(offset: _MemOffset): number; declare function getI64(offset: _MemOffset): number; declare function getF32(offset: _MemOffset): number; declare function getF64(offset: _MemOffset): number; declare function mono_run_main_and_exit(main_assembly_name: string, args: string[]): Promise<void>; declare function mono_run_main(main_assembly_name: string, args: string[]): Promise<number>; declare const MONO: { mono_wasm_setenv: typeof mono_wasm_setenv; mono_wasm_load_bytes_into_heap: typeof mono_wasm_load_bytes_into_heap; mono_wasm_load_icu_data: typeof mono_wasm_load_icu_data; mono_wasm_runtime_ready: typeof mono_wasm_runtime_ready; mono_wasm_load_data_archive: typeof mono_wasm_load_data_archive; mono_wasm_load_config: typeof mono_wasm_load_config; mono_load_runtime_and_bcl_args: typeof mono_load_runtime_and_bcl_args; mono_wasm_new_root_buffer: typeof mono_wasm_new_root_buffer; mono_wasm_new_root: typeof mono_wasm_new_root; mono_wasm_release_roots: typeof mono_wasm_release_roots; mono_run_main: typeof mono_run_main; mono_run_main_and_exit: typeof mono_run_main_and_exit; mono_wasm_add_assembly: (name: string, data: VoidPtr, size: number) => number; mono_wasm_load_runtime: (unused: string, debug_level: number) => void; config: MonoConfig | MonoConfigError; loaded_files: string[]; setI8: typeof setI8; setI16: typeof setI16; setI32: typeof setI32; setI64: typeof setI64; setU8: typeof setU8; setU16: typeof setU16; setU32: typeof setU32; setF32: typeof setF32; setF64: typeof setF64; getI8: typeof getI8; getI16: typeof getI16; getI32: typeof getI32; getI64: typeof getI64; getU8: typeof getU8; getU16: typeof getU16; getU32: typeof getU32; getF32: typeof getF32; getF64: typeof getF64; }; declare type MONOType = typeof MONO; declare const BINDING: { mono_obj_array_new: (size: number) => MonoArray; mono_obj_array_set: (array: MonoArray, idx: number, obj: MonoObject) => void; js_string_to_mono_string: typeof js_string_to_mono_string; js_typed_array_to_array: typeof js_typed_array_to_array; js_to_mono_obj: typeof js_to_mono_obj; mono_array_to_js_array: typeof mono_array_to_js_array; conv_string: typeof conv_string; bind_static_method: typeof mono_bind_static_method; call_assembly_entry_point: typeof mono_call_assembly_entry_point; unbox_mono_obj: typeof unbox_mono_obj; }; declare type BINDINGType = typeof BINDING; interface DotnetPublicAPI { MONO: typeof MONO; BINDING: typeof BINDING; INTERNAL: any; Module: EmscriptenModule; RuntimeId: number; RuntimeBuildInfo: { ProductVersion: string; Configuration: string; }; } declare function createDotnetRuntime(moduleFactory: DotnetModuleConfig | ((api: DotnetPublicAPI) => DotnetModuleConfig)): Promise<DotnetPublicAPI>; declare type CreateDotnetRuntimeType = typeof createDotnetRuntime; declare global { function getDotnetRuntime(runtimeId: number): DotnetPublicAPI | undefined; } export { BINDINGType, CreateDotnetRuntimeType, DotnetModuleConfig, DotnetPublicAPI, EmscriptenModule, MONOType, MonoArray, MonoObject, MonoString, VoidPtr, createDotnetRuntime as default };
//! Licensed to the .NET Foundation under one or more agreements. //! The .NET Foundation licenses this file to you under the MIT license. //! //! This is generated file, see src/mono/wasm/runtime/rollup.config.js //! This is not considered public API with backward compatibility guarantees. declare interface ManagedPointer { __brandManagedPointer: "ManagedPointer"; } declare interface NativePointer { __brandNativePointer: "NativePointer"; } declare interface VoidPtr extends NativePointer { __brand: "VoidPtr"; } declare interface CharPtr extends NativePointer { __brand: "CharPtr"; } declare interface Int32Ptr extends NativePointer { __brand: "Int32Ptr"; } declare interface EmscriptenModule { HEAP8: Int8Array; HEAP16: Int16Array; HEAP32: Int32Array; HEAPU8: Uint8Array; HEAPU16: Uint16Array; HEAPU32: Uint32Array; HEAPF32: Float32Array; HEAPF64: Float64Array; _malloc(size: number): VoidPtr; _free(ptr: VoidPtr): void; print(message: string): void; printErr(message: string): void; ccall<T>(ident: string, returnType?: string | null, argTypes?: string[], args?: any[], opts?: any): T; cwrap<T extends Function>(ident: string, returnType: string, argTypes?: string[], opts?: any): T; cwrap<T extends Function>(ident: string, ...args: any[]): T; setValue(ptr: VoidPtr, value: number, type: string, noSafe?: number | boolean): void; setValue(ptr: Int32Ptr, value: number, type: string, noSafe?: number | boolean): void; getValue(ptr: number, type: string, noSafe?: number | boolean): number; UTF8ToString(ptr: CharPtr, maxBytesToRead?: number): string; UTF8ArrayToString(u8Array: Uint8Array, idx?: number, maxBytesToRead?: number): string; FS_createPath(parent: string, path: string, canRead?: boolean, canWrite?: boolean): string; FS_createDataFile(parent: string, name: string, data: TypedArray, canRead: boolean, canWrite: boolean, canOwn?: boolean): string; FS_readFile(filename: string, opts: any): any; removeRunDependency(id: string): void; addRunDependency(id: string): void; ready: Promise<unknown>; preInit?: (() => any)[]; preRun?: (() => any)[]; postRun?: (() => any)[]; onAbort?: { (error: any): void; }; onRuntimeInitialized?: () => any; instantiateWasm: (imports: any, successCallback: Function) => any; } declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array; /** * Allocates a block of memory that can safely contain pointers into the managed heap. * The result object has get(index) and set(index, value) methods that can be used to retrieve and store managed pointers. * Once you are done using the root buffer, you must call its release() method. * For small numbers of roots, it is preferable to use the mono_wasm_new_root and mono_wasm_new_roots APIs instead. */ declare function mono_wasm_new_root_buffer(capacity: number, name?: string): WasmRootBuffer; /** * Allocates temporary storage for a pointer into the managed heap. * Pointers stored here will be visible to the GC, ensuring that the object they point to aren't moved or collected. * If you already have a managed pointer you can pass it as an argument to initialize the temporary storage. * The result object has get() and set(value) methods, along with a .value property. * When you are done using the root you must call its .release() method. */ declare function mono_wasm_new_root<T extends ManagedPointer | NativePointer>(value?: T | undefined): WasmRoot<T>; /** * Releases 1 or more root or root buffer objects. * Multiple objects may be passed on the argument list. * 'undefined' may be passed as an argument so it is safe to call this method from finally blocks * even if you are not sure all of your roots have been created yet. * @param {... WasmRoot} roots */ declare function mono_wasm_release_roots(...args: WasmRoot<any>[]): void; declare class WasmRootBuffer { private __count; private length; private __offset; private __offset32; private __handle; private __ownsAllocation; constructor(offset: VoidPtr, capacity: number, ownsAllocation: boolean, name?: string); _throw_index_out_of_range(): void; _check_in_range(index: number): void; get_address(index: number): NativePointer; get_address_32(index: number): number; get(index: number): ManagedPointer; set(index: number, value: ManagedPointer): ManagedPointer; _unsafe_get(index: number): number; _unsafe_set(index: number, value: ManagedPointer | NativePointer): void; clear(): void; release(): void; toString(): string; } interface WasmRoot<T extends ManagedPointer | NativePointer> { get_address(): NativePointer; get_address_32(): number; get(): T; set(value: T): T; get value(): T; set value(value: T); valueOf(): T; clear(): void; release(): void; toString(): string; } interface MonoObject extends ManagedPointer { __brandMonoObject: "MonoObject"; } interface MonoString extends MonoObject { __brand: "MonoString"; } interface MonoArray extends MonoObject { __brand: "MonoArray"; } declare type MonoConfig = { isError: false; assembly_root: string; assets: AllAssetEntryTypes[]; debug_level?: number; enable_debugging?: number; globalization_mode: GlobalizationMode; diagnostic_tracing?: boolean; remote_sources?: string[]; environment_variables?: { [i: string]: string; }; runtime_options?: string[]; aot_profiler_options?: AOTProfilerOptions; coverage_profiler_options?: CoverageProfilerOptions; ignore_pdb_load_errors?: boolean; }; declare type MonoConfigError = { isError: true; message: string; error: any; }; declare type AllAssetEntryTypes = AssetEntry | AssemblyEntry | SatelliteAssemblyEntry | VfsEntry | IcuData; declare type AssetEntry = { name: string; behavior: AssetBehaviours; virtual_path?: string; culture?: string; load_remote?: boolean; is_optional?: boolean; buffer?: ArrayBuffer; }; interface AssemblyEntry extends AssetEntry { name: "assembly"; } interface SatelliteAssemblyEntry extends AssetEntry { name: "resource"; culture: string; } interface VfsEntry extends AssetEntry { name: "vfs"; virtual_path: string; } interface IcuData extends AssetEntry { name: "icu"; load_remote: boolean; } declare const enum AssetBehaviours { Resource = "resource", Assembly = "assembly", Heap = "heap", ICU = "icu", VFS = "vfs" } declare const enum GlobalizationMode { ICU = "icu", INVARIANT = "invariant", AUTO = "auto" } declare type AOTProfilerOptions = { write_at?: string; send_to?: string; }; declare type CoverageProfilerOptions = { write_at?: string; send_to?: string; }; declare type DotnetModuleConfig = { disableDotnet6Compatibility?: boolean; config?: MonoConfig | MonoConfigError; configSrc?: string; onConfigLoaded?: (config: MonoConfig) => Promise<void>; onDotnetReady?: () => void; imports?: DotnetModuleConfigImports; } & Partial<EmscriptenModule>; declare type DotnetModuleConfigImports = { require?: (name: string) => any; fetch?: (url: string) => Promise<Response>; fs?: { promises?: { readFile?: (path: string) => Promise<string | Buffer>; }; readFileSync?: (path: string, options: any | undefined) => string; }; crypto?: { randomBytes?: (size: number) => Buffer; }; ws?: WebSocket & { Server: any; }; path?: { normalize?: (path: string) => string; dirname?: (path: string) => string; }; url?: any; }; declare function mono_wasm_runtime_ready(): void; declare function mono_wasm_setenv(name: string, value: string): void; declare function mono_load_runtime_and_bcl_args(config: MonoConfig | MonoConfigError | undefined): Promise<void>; declare function mono_wasm_load_data_archive(data: Uint8Array, prefix: string): boolean; /** * Loads the mono config file (typically called mono-config.json) asynchroniously * Note: the run dependencies are so emsdk actually awaits it in order. * * @param {string} configFilePath - relative path to the config file * @throws Will throw an error if the config file loading fails */ declare function mono_wasm_load_config(configFilePath: string): Promise<void>; declare function mono_wasm_load_icu_data(offset: VoidPtr): boolean; declare function conv_string(mono_obj: MonoString): string | null; declare function js_string_to_mono_string(string: string): MonoString; declare function js_to_mono_obj(js_obj: any): MonoObject; declare function js_typed_array_to_array(js_obj: any): MonoArray; declare function unbox_mono_obj(mono_obj: MonoObject): any; declare function mono_array_to_js_array(mono_array: MonoArray): any[] | null; declare function mono_bind_static_method(fqn: string, signature?: string): Function; declare function mono_call_assembly_entry_point(assembly: string, args?: any[], signature?: string): number; declare function mono_wasm_load_bytes_into_heap(bytes: Uint8Array): VoidPtr; declare type _MemOffset = number | VoidPtr | NativePointer; declare type _NumberOrPointer = number | VoidPtr | NativePointer | ManagedPointer; declare function setU8(offset: _MemOffset, value: number): void; declare function setU16(offset: _MemOffset, value: number): void; declare function setU32(offset: _MemOffset, value: _NumberOrPointer): void; declare function setI8(offset: _MemOffset, value: number): void; declare function setI16(offset: _MemOffset, value: number): void; declare function setI32(offset: _MemOffset, value: _NumberOrPointer): void; declare function setI64(offset: _MemOffset, value: number): void; declare function setF32(offset: _MemOffset, value: number): void; declare function setF64(offset: _MemOffset, value: number): void; declare function getU8(offset: _MemOffset): number; declare function getU16(offset: _MemOffset): number; declare function getU32(offset: _MemOffset): number; declare function getI8(offset: _MemOffset): number; declare function getI16(offset: _MemOffset): number; declare function getI32(offset: _MemOffset): number; declare function getI64(offset: _MemOffset): number; declare function getF32(offset: _MemOffset): number; declare function getF64(offset: _MemOffset): number; declare function mono_run_main_and_exit(main_assembly_name: string, args: string[]): Promise<void>; declare function mono_run_main(main_assembly_name: string, args: string[]): Promise<number>; declare const MONO: { mono_wasm_setenv: typeof mono_wasm_setenv; mono_wasm_load_bytes_into_heap: typeof mono_wasm_load_bytes_into_heap; mono_wasm_load_icu_data: typeof mono_wasm_load_icu_data; mono_wasm_runtime_ready: typeof mono_wasm_runtime_ready; mono_wasm_load_data_archive: typeof mono_wasm_load_data_archive; mono_wasm_load_config: typeof mono_wasm_load_config; mono_load_runtime_and_bcl_args: typeof mono_load_runtime_and_bcl_args; mono_wasm_new_root_buffer: typeof mono_wasm_new_root_buffer; mono_wasm_new_root: typeof mono_wasm_new_root; mono_wasm_release_roots: typeof mono_wasm_release_roots; mono_run_main: typeof mono_run_main; mono_run_main_and_exit: typeof mono_run_main_and_exit; mono_wasm_add_assembly: (name: string, data: VoidPtr, size: number) => number; mono_wasm_load_runtime: (unused: string, debug_level: number) => void; config: MonoConfig | MonoConfigError; loaded_files: string[]; setI8: typeof setI8; setI16: typeof setI16; setI32: typeof setI32; setI64: typeof setI64; setU8: typeof setU8; setU16: typeof setU16; setU32: typeof setU32; setF32: typeof setF32; setF64: typeof setF64; getI8: typeof getI8; getI16: typeof getI16; getI32: typeof getI32; getI64: typeof getI64; getU8: typeof getU8; getU16: typeof getU16; getU32: typeof getU32; getF32: typeof getF32; getF64: typeof getF64; }; declare type MONOType = typeof MONO; declare const BINDING: { mono_obj_array_new: (size: number) => MonoArray; mono_obj_array_set: (array: MonoArray, idx: number, obj: MonoObject) => void; js_string_to_mono_string: typeof js_string_to_mono_string; js_typed_array_to_array: typeof js_typed_array_to_array; js_to_mono_obj: typeof js_to_mono_obj; mono_array_to_js_array: typeof mono_array_to_js_array; conv_string: typeof conv_string; bind_static_method: typeof mono_bind_static_method; call_assembly_entry_point: typeof mono_call_assembly_entry_point; unbox_mono_obj: typeof unbox_mono_obj; }; declare type BINDINGType = typeof BINDING; interface DotnetPublicAPI { MONO: typeof MONO; BINDING: typeof BINDING; INTERNAL: any; Module: EmscriptenModule; RuntimeId: number; RuntimeBuildInfo: { ProductVersion: string; Configuration: string; }; } declare function createDotnetRuntime(moduleFactory: DotnetModuleConfig | ((api: DotnetPublicAPI) => DotnetModuleConfig)): Promise<DotnetPublicAPI>; declare type CreateDotnetRuntimeType = typeof createDotnetRuntime; declare global { function getDotnetRuntime(runtimeId: number): DotnetPublicAPI | undefined; } export { BINDINGType, CreateDotnetRuntimeType, DotnetModuleConfig, DotnetPublicAPI, EmscriptenModule, MONOType, MonoArray, MonoObject, MonoString, VoidPtr, createDotnetRuntime as default };
1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/mono/wasm/runtime/exports.ts
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. import ProductVersion from "consts:productVersion"; import Configuration from "consts:configuration"; import { mono_wasm_new_root, mono_wasm_release_roots, mono_wasm_new_root_buffer } from "./roots"; import { mono_wasm_send_dbg_command_with_parms, mono_wasm_send_dbg_command, mono_wasm_get_dbg_command_info, mono_wasm_get_details, mono_wasm_release_object, mono_wasm_call_function_on, mono_wasm_debugger_resume, mono_wasm_detach_debugger, mono_wasm_runtime_ready, mono_wasm_get_loaded_files, mono_wasm_raise_debug_event, mono_wasm_fire_debugger_agent_message, mono_wasm_debugger_log, mono_wasm_trace_logger, mono_wasm_add_dbg_command_received, mono_wasm_change_debugger_log_level, } from "./debug"; import { ENVIRONMENT_IS_WEB, ExitStatusError, runtimeHelpers, setImportsAndExports } from "./imports"; import { DotnetModuleConfigImports, DotnetModule } from "./types"; import { mono_load_runtime_and_bcl_args, mono_wasm_load_config, mono_wasm_setenv, mono_wasm_set_runtime_options, mono_wasm_load_data_archive, mono_wasm_asm_loaded, configure_emscripten_startup } from "./startup"; import { mono_set_timeout, schedule_background_exec } from "./scheduling"; import { mono_wasm_load_icu_data, mono_wasm_get_icudt_name } from "./icu"; import { conv_string, js_string_to_mono_string, mono_intern_string } from "./strings"; import { js_to_mono_obj, js_typed_array_to_array, mono_wasm_typed_array_to_array } from "./js-to-cs"; import { mono_array_to_js_array, mono_wasm_create_cs_owned_object, unbox_mono_obj } from "./cs-to-js"; import { call_static_method, mono_bind_static_method, mono_call_assembly_entry_point, mono_method_resolve, mono_wasm_compile_function, mono_wasm_get_by_index, mono_wasm_get_global_object, mono_wasm_get_object_property, mono_wasm_invoke_js, mono_wasm_invoke_js_blazor, mono_wasm_invoke_js_with_args, mono_wasm_set_by_index, mono_wasm_set_object_property } from "./method-calls"; import { mono_wasm_typed_array_copy_to, mono_wasm_typed_array_from, mono_wasm_typed_array_copy_from, mono_wasm_load_bytes_into_heap } from "./buffers"; import { mono_wasm_cancel_promise } from "./cancelable-promise"; import { mono_wasm_add_event_listener, mono_wasm_remove_event_listener } from "./event-listener"; import { mono_wasm_release_cs_owned_object } from "./gc-handles"; import { mono_wasm_web_socket_open, mono_wasm_web_socket_send, mono_wasm_web_socket_receive, mono_wasm_web_socket_close, mono_wasm_web_socket_abort } from "./web-socket"; import cwraps from "./cwraps"; import { setI8, setI16, setI32, setI64, setU8, setU16, setU32, setF32, setF64, getI8, getI16, getI32, getI64, getU8, getU16, getU32, getF32, getF64, } from "./memory"; import { create_weak_ref } from "./weak-ref"; import { fetch_like, readAsync_like } from "./polyfills"; import { EmscriptenModule } from "./types/emscripten"; import { mono_run_main, mono_run_main_and_exit } from "./run"; const MONO = { // current "public" MONO API mono_wasm_setenv, mono_wasm_load_bytes_into_heap, mono_wasm_load_icu_data, mono_wasm_runtime_ready, mono_wasm_load_data_archive, mono_wasm_load_config, mono_load_runtime_and_bcl_args, mono_wasm_new_root_buffer, mono_wasm_new_root, mono_wasm_release_roots, mono_run_main, mono_run_main_and_exit, // for Blazor's future! mono_wasm_add_assembly: cwraps.mono_wasm_add_assembly, mono_wasm_load_runtime: cwraps.mono_wasm_load_runtime, config: runtimeHelpers.config, loaded_files: <string[]>[], // memory accessors setI8, setI16, setI32, setI64, setU8, setU16, setU32, setF32, setF64, getI8, getI16, getI32, getI64, getU8, getU16, getU32, getF32, getF64, }; export type MONOType = typeof MONO; const BINDING = { //current "public" BINDING API mono_obj_array_new: cwraps.mono_wasm_obj_array_new, mono_obj_array_set: cwraps.mono_wasm_obj_array_set, js_string_to_mono_string, js_typed_array_to_array, js_to_mono_obj, mono_array_to_js_array, conv_string, bind_static_method: mono_bind_static_method, call_assembly_entry_point: mono_call_assembly_entry_point, unbox_mono_obj, }; export type BINDINGType = typeof BINDING; let exportedAPI: DotnetPublicAPI; // this is executed early during load of emscripten runtime // it exports methods to global objects MONO, BINDING and Module in backward compatible way // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types function initializeImportsAndExports( imports: { isESM: boolean, isGlobal: boolean, isNode: boolean, isShell: boolean, isWeb: boolean, locateFile: Function, quit_: Function, ExitStatus: ExitStatusError, requirePromise: Promise<Function> }, exports: { mono: any, binding: any, internal: any, module: any }, replacements: { fetch: any, readAsync: any, require: any, requireOut: any, noExitRuntime: boolean }, ): DotnetPublicAPI { const module = exports.module as DotnetModule; const globalThisAny = globalThis as any; // we want to have same instance of MONO, BINDING and Module in dotnet iffe setImportsAndExports(imports, exports); // here we merge methods from the local objects into exported objects Object.assign(exports.mono, MONO); Object.assign(exports.binding, BINDING); Object.assign(exports.internal, INTERNAL); exportedAPI = <any>{ MONO: exports.mono, BINDING: exports.binding, INTERNAL: exports.internal, Module: module, RuntimeBuildInfo: { ProductVersion, Configuration } }; if (exports.module.__undefinedConfig) { module.disableDotnet6Compatibility = true; module.configSrc = "./mono-config.json"; } if (!module.print) { module.print = console.log.bind(console); } if (!module.printErr) { module.printErr = console.error.bind(console); } module.imports = module.imports || <DotnetModuleConfigImports>{}; if (!module.imports.require) { module.imports.require = (name) => { const resolved = (<any>module.imports)[name]; if (resolved) { return resolved; } if (replacements.require) { return replacements.require(name); } throw new Error(`Please provide Module.imports.${name} or Module.imports.require`); }; } if (module.imports.fetch) { runtimeHelpers.fetch = module.imports.fetch; } else { runtimeHelpers.fetch = fetch_like; } replacements.fetch = runtimeHelpers.fetch; replacements.readAsync = readAsync_like; replacements.requireOut = module.imports.require; replacements.noExitRuntime = ENVIRONMENT_IS_WEB; if (typeof module.disableDotnet6Compatibility === "undefined") { module.disableDotnet6Compatibility = imports.isESM; } // here we expose objects global namespace for tests and backward compatibility if (imports.isGlobal || !module.disableDotnet6Compatibility) { Object.assign(module, exportedAPI); // backward compatibility // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore module.mono_bind_static_method = (fqn: string, signature: string/*ArgsMarshalString*/): Function => { console.warn("Module.mono_bind_static_method is obsolete, please use BINDING.bind_static_method instead"); return mono_bind_static_method(fqn, signature); }; const warnWrap = (name: string, provider: () => any) => { if (typeof globalThisAny[name] !== "undefined") { // it already exists in the global namespace return; } let value: any = undefined; Object.defineProperty(globalThis, name, { get: () => { if (!value) { const stack = (new Error()).stack; const nextLine = stack ? stack.substr(stack.indexOf("\n", 8) + 1) : ""; console.warn(`global ${name} is obsolete, please use Module.${name} instead ${nextLine}`); value = provider(); } return value; } }); }; globalThisAny.MONO = exports.mono; globalThisAny.BINDING = exports.binding; globalThisAny.INTERNAL = exports.internal; if (!imports.isGlobal) { globalThisAny.Module = module; } // Blazor back compat warnWrap("cwrap", () => module.cwrap); warnWrap("addRunDependency", () => module.addRunDependency); warnWrap("removeRunDependency", () => module.removeRunDependency); } // this code makes it possible to find dotnet runtime on a page via global namespace, even when there are multiple runtimes at the same time let list: RuntimeList; if (!globalThisAny.getDotnetRuntime) { globalThisAny.getDotnetRuntime = (runtimeId: string) => globalThisAny.getDotnetRuntime.__list.getRuntime(runtimeId); globalThisAny.getDotnetRuntime.__list = list = new RuntimeList(); } else { list = globalThisAny.getDotnetRuntime.__list; } list.registerRuntime(exportedAPI); configure_emscripten_startup(module, exportedAPI); return exportedAPI; } export const __initializeImportsAndExports: any = initializeImportsAndExports; // don't want to export the type // the methods would be visible to EMCC linker // --- keep in sync with dotnet.cjs.lib.js --- export const __linker_exports: any = { // mini-wasm.c mono_set_timeout, // mini-wasm-debugger.c mono_wasm_asm_loaded, mono_wasm_fire_debugger_agent_message, mono_wasm_debugger_log, mono_wasm_add_dbg_command_received, // mono-threads-wasm.c schedule_background_exec, // also keep in sync with driver.c mono_wasm_invoke_js, mono_wasm_invoke_js_blazor, mono_wasm_trace_logger, // also keep in sync with corebindings.c mono_wasm_invoke_js_with_args, mono_wasm_get_object_property, mono_wasm_set_object_property, mono_wasm_get_by_index, mono_wasm_set_by_index, mono_wasm_get_global_object, mono_wasm_create_cs_owned_object, mono_wasm_release_cs_owned_object, mono_wasm_typed_array_to_array, mono_wasm_typed_array_copy_to, mono_wasm_typed_array_from, mono_wasm_typed_array_copy_from, mono_wasm_add_event_listener, mono_wasm_remove_event_listener, mono_wasm_cancel_promise, mono_wasm_web_socket_open, mono_wasm_web_socket_send, mono_wasm_web_socket_receive, mono_wasm_web_socket_close, mono_wasm_web_socket_abort, mono_wasm_compile_function, // also keep in sync with pal_icushim_static.c mono_wasm_load_icu_data, mono_wasm_get_icudt_name, }; const INTERNAL: any = { // startup BINDING_ASM: "[System.Private.Runtime.InteropServices.JavaScript]System.Runtime.InteropServices.JavaScript.Runtime", // tests call_static_method, mono_wasm_exit: cwraps.mono_wasm_exit, mono_wasm_enable_on_demand_gc: cwraps.mono_wasm_enable_on_demand_gc, mono_profiler_init_aot: cwraps.mono_profiler_init_aot, mono_wasm_set_runtime_options, mono_wasm_exec_regression: cwraps.mono_wasm_exec_regression, mono_method_resolve,//MarshalTests.cs mono_bind_static_method,// MarshalTests.cs mono_intern_string,// MarshalTests.cs // with mono_wasm_debugger_log and mono_wasm_trace_logger logging: undefined, // used in debugger DevToolsHelper.cs mono_wasm_get_loaded_files, mono_wasm_send_dbg_command_with_parms, mono_wasm_send_dbg_command, mono_wasm_get_dbg_command_info, mono_wasm_get_details, mono_wasm_release_object, mono_wasm_call_function_on, mono_wasm_debugger_resume, mono_wasm_detach_debugger, mono_wasm_raise_debug_event, mono_wasm_change_debugger_log_level, mono_wasm_runtime_is_ready: runtimeHelpers.mono_wasm_runtime_is_ready, }; // this represents visibility in the javascript // like https://github.com/dotnet/aspnetcore/blob/main/src/Components/Web.JS/src/Platform/Mono/MonoTypes.ts export interface DotnetPublicAPI { MONO: typeof MONO, BINDING: typeof BINDING, INTERNAL: any, Module: EmscriptenModule, RuntimeId: number, RuntimeBuildInfo: { ProductVersion: string, Configuration: string, } } class RuntimeList { private list: { [runtimeId: number]: WeakRef<DotnetPublicAPI> } = {}; public registerRuntime(api: DotnetPublicAPI): number { api.RuntimeId = Object.keys(this.list).length; this.list[api.RuntimeId] = create_weak_ref(api); return api.RuntimeId; } public getRuntime(runtimeId: number): DotnetPublicAPI | undefined { const wr = this.list[runtimeId]; return wr ? wr.deref() : undefined; } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. import ProductVersion from "consts:productVersion"; import Configuration from "consts:configuration"; import { mono_wasm_new_root, mono_wasm_release_roots, mono_wasm_new_root_buffer } from "./roots"; import { mono_wasm_send_dbg_command_with_parms, mono_wasm_send_dbg_command, mono_wasm_get_dbg_command_info, mono_wasm_get_details, mono_wasm_release_object, mono_wasm_call_function_on, mono_wasm_debugger_resume, mono_wasm_detach_debugger, mono_wasm_runtime_ready, mono_wasm_get_loaded_files, mono_wasm_raise_debug_event, mono_wasm_fire_debugger_agent_message, mono_wasm_debugger_log, mono_wasm_trace_logger, mono_wasm_add_dbg_command_received, mono_wasm_change_debugger_log_level, mono_wasm_symbolicate_string, mono_wasm_stringify_as_error_with_stack, } from "./debug"; import { ENVIRONMENT_IS_WEB, ExitStatusError, runtimeHelpers, setImportsAndExports } from "./imports"; import { DotnetModuleConfigImports, DotnetModule } from "./types"; import { mono_load_runtime_and_bcl_args, mono_wasm_load_config, mono_wasm_setenv, mono_wasm_set_runtime_options, mono_wasm_load_data_archive, mono_wasm_asm_loaded, configure_emscripten_startup } from "./startup"; import { mono_set_timeout, schedule_background_exec } from "./scheduling"; import { mono_wasm_load_icu_data, mono_wasm_get_icudt_name } from "./icu"; import { conv_string, js_string_to_mono_string, mono_intern_string } from "./strings"; import { js_to_mono_obj, js_typed_array_to_array, mono_wasm_typed_array_to_array } from "./js-to-cs"; import { mono_array_to_js_array, mono_wasm_create_cs_owned_object, unbox_mono_obj } from "./cs-to-js"; import { call_static_method, mono_bind_static_method, mono_call_assembly_entry_point, mono_method_resolve, mono_wasm_compile_function, mono_wasm_get_by_index, mono_wasm_get_global_object, mono_wasm_get_object_property, mono_wasm_invoke_js, mono_wasm_invoke_js_blazor, mono_wasm_invoke_js_with_args, mono_wasm_set_by_index, mono_wasm_set_object_property } from "./method-calls"; import { mono_wasm_typed_array_copy_to, mono_wasm_typed_array_from, mono_wasm_typed_array_copy_from, mono_wasm_load_bytes_into_heap } from "./buffers"; import { mono_wasm_cancel_promise } from "./cancelable-promise"; import { mono_wasm_add_event_listener, mono_wasm_remove_event_listener } from "./event-listener"; import { mono_wasm_release_cs_owned_object } from "./gc-handles"; import { mono_wasm_web_socket_open, mono_wasm_web_socket_send, mono_wasm_web_socket_receive, mono_wasm_web_socket_close, mono_wasm_web_socket_abort } from "./web-socket"; import cwraps from "./cwraps"; import { setI8, setI16, setI32, setI64, setU8, setU16, setU32, setF32, setF64, getI8, getI16, getI32, getI64, getU8, getU16, getU32, getF32, getF64, } from "./memory"; import { create_weak_ref } from "./weak-ref"; import { fetch_like, readAsync_like } from "./polyfills"; import { EmscriptenModule } from "./types/emscripten"; import { mono_run_main, mono_run_main_and_exit } from "./run"; const MONO = { // current "public" MONO API mono_wasm_setenv, mono_wasm_load_bytes_into_heap, mono_wasm_load_icu_data, mono_wasm_runtime_ready, mono_wasm_load_data_archive, mono_wasm_load_config, mono_load_runtime_and_bcl_args, mono_wasm_new_root_buffer, mono_wasm_new_root, mono_wasm_release_roots, mono_run_main, mono_run_main_and_exit, // for Blazor's future! mono_wasm_add_assembly: cwraps.mono_wasm_add_assembly, mono_wasm_load_runtime: cwraps.mono_wasm_load_runtime, config: runtimeHelpers.config, loaded_files: <string[]>[], // memory accessors setI8, setI16, setI32, setI64, setU8, setU16, setU32, setF32, setF64, getI8, getI16, getI32, getI64, getU8, getU16, getU32, getF32, getF64, }; export type MONOType = typeof MONO; const BINDING = { //current "public" BINDING API mono_obj_array_new: cwraps.mono_wasm_obj_array_new, mono_obj_array_set: cwraps.mono_wasm_obj_array_set, js_string_to_mono_string, js_typed_array_to_array, js_to_mono_obj, mono_array_to_js_array, conv_string, bind_static_method: mono_bind_static_method, call_assembly_entry_point: mono_call_assembly_entry_point, unbox_mono_obj, }; export type BINDINGType = typeof BINDING; let exportedAPI: DotnetPublicAPI; // this is executed early during load of emscripten runtime // it exports methods to global objects MONO, BINDING and Module in backward compatible way // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types function initializeImportsAndExports( imports: { isESM: boolean, isGlobal: boolean, isNode: boolean, isShell: boolean, isWeb: boolean, locateFile: Function, quit_: Function, ExitStatus: ExitStatusError, requirePromise: Promise<Function> }, exports: { mono: any, binding: any, internal: any, module: any }, replacements: { fetch: any, readAsync: any, require: any, requireOut: any, noExitRuntime: boolean }, ): DotnetPublicAPI { const module = exports.module as DotnetModule; const globalThisAny = globalThis as any; // we want to have same instance of MONO, BINDING and Module in dotnet iffe setImportsAndExports(imports, exports); // here we merge methods from the local objects into exported objects Object.assign(exports.mono, MONO); Object.assign(exports.binding, BINDING); Object.assign(exports.internal, INTERNAL); exportedAPI = <any>{ MONO: exports.mono, BINDING: exports.binding, INTERNAL: exports.internal, Module: module, RuntimeBuildInfo: { ProductVersion, Configuration } }; if (exports.module.__undefinedConfig) { module.disableDotnet6Compatibility = true; module.configSrc = "./mono-config.json"; } if (!module.print) { module.print = console.log.bind(console); } if (!module.printErr) { module.printErr = console.error.bind(console); } module.imports = module.imports || <DotnetModuleConfigImports>{}; if (!module.imports.require) { module.imports.require = (name) => { const resolved = (<any>module.imports)[name]; if (resolved) { return resolved; } if (replacements.require) { return replacements.require(name); } throw new Error(`Please provide Module.imports.${name} or Module.imports.require`); }; } if (module.imports.fetch) { runtimeHelpers.fetch = module.imports.fetch; } else { runtimeHelpers.fetch = fetch_like; } replacements.fetch = runtimeHelpers.fetch; replacements.readAsync = readAsync_like; replacements.requireOut = module.imports.require; replacements.noExitRuntime = ENVIRONMENT_IS_WEB; if (typeof module.disableDotnet6Compatibility === "undefined") { module.disableDotnet6Compatibility = imports.isESM; } // here we expose objects global namespace for tests and backward compatibility if (imports.isGlobal || !module.disableDotnet6Compatibility) { Object.assign(module, exportedAPI); // backward compatibility // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore module.mono_bind_static_method = (fqn: string, signature: string/*ArgsMarshalString*/): Function => { console.warn("Module.mono_bind_static_method is obsolete, please use BINDING.bind_static_method instead"); return mono_bind_static_method(fqn, signature); }; const warnWrap = (name: string, provider: () => any) => { if (typeof globalThisAny[name] !== "undefined") { // it already exists in the global namespace return; } let value: any = undefined; Object.defineProperty(globalThis, name, { get: () => { if (!value) { const stack = (new Error()).stack; const nextLine = stack ? stack.substr(stack.indexOf("\n", 8) + 1) : ""; console.warn(`global ${name} is obsolete, please use Module.${name} instead ${nextLine}`); value = provider(); } return value; } }); }; globalThisAny.MONO = exports.mono; globalThisAny.BINDING = exports.binding; globalThisAny.INTERNAL = exports.internal; if (!imports.isGlobal) { globalThisAny.Module = module; } // Blazor back compat warnWrap("cwrap", () => module.cwrap); warnWrap("addRunDependency", () => module.addRunDependency); warnWrap("removeRunDependency", () => module.removeRunDependency); } // this code makes it possible to find dotnet runtime on a page via global namespace, even when there are multiple runtimes at the same time let list: RuntimeList; if (!globalThisAny.getDotnetRuntime) { globalThisAny.getDotnetRuntime = (runtimeId: string) => globalThisAny.getDotnetRuntime.__list.getRuntime(runtimeId); globalThisAny.getDotnetRuntime.__list = list = new RuntimeList(); } else { list = globalThisAny.getDotnetRuntime.__list; } list.registerRuntime(exportedAPI); configure_emscripten_startup(module, exportedAPI); return exportedAPI; } export const __initializeImportsAndExports: any = initializeImportsAndExports; // don't want to export the type // the methods would be visible to EMCC linker // --- keep in sync with dotnet.cjs.lib.js --- export const __linker_exports: any = { // mini-wasm.c mono_set_timeout, // mini-wasm-debugger.c mono_wasm_asm_loaded, mono_wasm_fire_debugger_agent_message, mono_wasm_debugger_log, mono_wasm_add_dbg_command_received, // mono-threads-wasm.c schedule_background_exec, // also keep in sync with driver.c mono_wasm_invoke_js, mono_wasm_invoke_js_blazor, mono_wasm_trace_logger, // also keep in sync with corebindings.c mono_wasm_invoke_js_with_args, mono_wasm_get_object_property, mono_wasm_set_object_property, mono_wasm_get_by_index, mono_wasm_set_by_index, mono_wasm_get_global_object, mono_wasm_create_cs_owned_object, mono_wasm_release_cs_owned_object, mono_wasm_typed_array_to_array, mono_wasm_typed_array_copy_to, mono_wasm_typed_array_from, mono_wasm_typed_array_copy_from, mono_wasm_add_event_listener, mono_wasm_remove_event_listener, mono_wasm_cancel_promise, mono_wasm_web_socket_open, mono_wasm_web_socket_send, mono_wasm_web_socket_receive, mono_wasm_web_socket_close, mono_wasm_web_socket_abort, mono_wasm_compile_function, // also keep in sync with pal_icushim_static.c mono_wasm_load_icu_data, mono_wasm_get_icudt_name, }; const INTERNAL: any = { // startup BINDING_ASM: "[System.Private.Runtime.InteropServices.JavaScript]System.Runtime.InteropServices.JavaScript.Runtime", // tests call_static_method, mono_wasm_exit: cwraps.mono_wasm_exit, mono_wasm_enable_on_demand_gc: cwraps.mono_wasm_enable_on_demand_gc, mono_profiler_init_aot: cwraps.mono_profiler_init_aot, mono_wasm_set_runtime_options, mono_wasm_exec_regression: cwraps.mono_wasm_exec_regression, mono_method_resolve,//MarshalTests.cs mono_bind_static_method,// MarshalTests.cs mono_intern_string,// MarshalTests.cs // with mono_wasm_debugger_log and mono_wasm_trace_logger logging: undefined, // mono_wasm_symbolicate_string, mono_wasm_stringify_as_error_with_stack, // used in debugger DevToolsHelper.cs mono_wasm_get_loaded_files, mono_wasm_send_dbg_command_with_parms, mono_wasm_send_dbg_command, mono_wasm_get_dbg_command_info, mono_wasm_get_details, mono_wasm_release_object, mono_wasm_call_function_on, mono_wasm_debugger_resume, mono_wasm_detach_debugger, mono_wasm_raise_debug_event, mono_wasm_change_debugger_log_level, mono_wasm_runtime_is_ready: runtimeHelpers.mono_wasm_runtime_is_ready, }; // this represents visibility in the javascript // like https://github.com/dotnet/aspnetcore/blob/main/src/Components/Web.JS/src/Platform/Mono/MonoTypes.ts export interface DotnetPublicAPI { MONO: typeof MONO, BINDING: typeof BINDING, INTERNAL: any, Module: EmscriptenModule, RuntimeId: number, RuntimeBuildInfo: { ProductVersion: string, Configuration: string, } } class RuntimeList { private list: { [runtimeId: number]: WeakRef<DotnetPublicAPI> } = {}; public registerRuntime(api: DotnetPublicAPI): number { api.RuntimeId = Object.keys(this.list).length; this.list[api.RuntimeId] = create_weak_ref(api); return api.RuntimeId; } public getRuntime(runtimeId: number): DotnetPublicAPI | undefined { const wr = this.list[runtimeId]; return wr ? wr.deref() : undefined; } }
1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/mono/wasm/runtime/imports.ts
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /* eslint-disable @typescript-eslint/triple-slash-reference */ /// <reference path="./types/v8.d.ts" /> import { DotnetModule, MonoConfig, RuntimeHelpers } from "./types"; import { EmscriptenModule } from "./types/emscripten"; // these are our public API (except internal) export let Module: EmscriptenModule & DotnetModule; export let MONO: any; export let BINDING: any; export let INTERNAL: any; // these are imported and re-exported from emscripten internals export let ENVIRONMENT_IS_ESM: boolean; export let ENVIRONMENT_IS_NODE: boolean; export let ENVIRONMENT_IS_SHELL: boolean; export let ENVIRONMENT_IS_WEB: boolean; export let locateFile: Function; export let quit: Function; export let ExitStatus: ExitStatusError; export let requirePromise: Promise<Function>; export interface ExitStatusError { new(status: number): any; } // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export function setImportsAndExports( imports: { isESM: boolean, isNode: boolean, isShell: boolean, isWeb: boolean, locateFile: Function, ExitStatus: ExitStatusError, quit_: Function, requirePromise: Promise<Function> }, exports: { mono: any, binding: any, internal: any, module: any }, ): void { MONO = exports.mono; BINDING = exports.binding; INTERNAL = exports.internal; Module = exports.module; ENVIRONMENT_IS_ESM = imports.isESM; ENVIRONMENT_IS_NODE = imports.isNode; ENVIRONMENT_IS_SHELL = imports.isShell; ENVIRONMENT_IS_WEB = imports.isWeb; locateFile = imports.locateFile; quit = imports.quit_; ExitStatus = imports.ExitStatus; requirePromise = imports.requirePromise; } let monoConfig: MonoConfig; let runtime_is_ready = false; export const runtimeHelpers: RuntimeHelpers = <any>{ namespace: "System.Runtime.InteropServices.JavaScript", classname: "Runtime", get mono_wasm_runtime_is_ready() { return runtime_is_ready; }, set mono_wasm_runtime_is_ready(value: boolean) { runtime_is_ready = value; INTERNAL.mono_wasm_runtime_is_ready = value; }, get config() { return monoConfig; }, set config(value: MonoConfig) { monoConfig = value; MONO.config = value; Module.config = value; }, fetch: null };
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /* eslint-disable @typescript-eslint/triple-slash-reference */ /// <reference path="./types/v8.d.ts" /> import { DotnetModule, MonoConfig, RuntimeHelpers } from "./types"; import { EmscriptenModule } from "./types/emscripten"; // these are our public API (except internal) export let Module: EmscriptenModule & DotnetModule; export let MONO: any; export let BINDING: any; export let INTERNAL: any; // these are imported and re-exported from emscripten internals export let ENVIRONMENT_IS_ESM: boolean; export let ENVIRONMENT_IS_NODE: boolean; export let ENVIRONMENT_IS_SHELL: boolean; export let ENVIRONMENT_IS_WEB: boolean; export let locateFile: Function; export let quit: Function; export let ExitStatus: ExitStatusError; export let requirePromise: Promise<Function>; export let readFile: Function; export interface ExitStatusError { new(status: number): any; } // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export function setImportsAndExports( imports: { isESM: boolean, isNode: boolean, isShell: boolean, isWeb: boolean, locateFile: Function, ExitStatus: ExitStatusError, quit_: Function, requirePromise: Promise<Function> }, exports: { mono: any, binding: any, internal: any, module: any }, ): void { MONO = exports.mono; BINDING = exports.binding; INTERNAL = exports.internal; Module = exports.module; ENVIRONMENT_IS_ESM = imports.isESM; ENVIRONMENT_IS_NODE = imports.isNode; ENVIRONMENT_IS_SHELL = imports.isShell; ENVIRONMENT_IS_WEB = imports.isWeb; locateFile = imports.locateFile; quit = imports.quit_; ExitStatus = imports.ExitStatus; requirePromise = imports.requirePromise; } let monoConfig: MonoConfig; let runtime_is_ready = false; export const runtimeHelpers: RuntimeHelpers = <any>{ namespace: "System.Runtime.InteropServices.JavaScript", classname: "Runtime", get mono_wasm_runtime_is_ready() { return runtime_is_ready; }, set mono_wasm_runtime_is_ready(value: boolean) { runtime_is_ready = value; INTERNAL.mono_wasm_runtime_is_ready = value; }, get config() { return monoConfig; }, set config(value: MonoConfig) { monoConfig = value; MONO.config = value; Module.config = value; }, fetch: null };
1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/mono/wasm/runtime/method-calls.ts
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. import { mono_wasm_new_root, mono_wasm_new_root_buffer, WasmRoot, WasmRootBuffer } from "./roots"; import { JSHandle, MonoArray, MonoMethod, MonoObject, MonoObjectNull, MonoString, coerceNull as coerceNull, VoidPtrNull, MonoStringNull } from "./types"; import { BINDING, INTERNAL, Module, MONO, runtimeHelpers } from "./imports"; import { _mono_array_root_to_js_array, _unbox_mono_obj_root } from "./cs-to-js"; import { get_js_obj, mono_wasm_get_jsobj_from_js_handle } from "./gc-handles"; import { js_array_to_mono_array, _box_js_bool, _js_to_mono_obj } from "./js-to-cs"; import { mono_bind_method, Converter, _compile_converter_for_marshal_string, _decide_if_result_is_marshaled, find_method, BoundMethodToken } from "./method-binding"; import { conv_string, js_string_to_mono_string } from "./strings"; import cwraps from "./cwraps"; import { bindings_lazy_init } from "./startup"; import { _create_temp_frame, _release_temp_frame } from "./memory"; import { VoidPtr, Int32Ptr, EmscriptenModule } from "./types/emscripten"; function _verify_args_for_method_call(args_marshal: string/*ArgsMarshalString*/, args: any) { const has_args = args && (typeof args === "object") && args.length > 0; const has_args_marshal = typeof args_marshal === "string"; if (has_args) { if (!has_args_marshal) throw new Error("No signature provided for method call."); else if (args.length > args_marshal.length) throw new Error("Too many parameter values. Expected at most " + args_marshal.length + " value(s) for signature " + args_marshal); } return has_args_marshal && has_args; } export function _get_buffer_for_method_call(converter: Converter, token: BoundMethodToken | null): VoidPtr | undefined { if (!converter) return VoidPtrNull; let result = VoidPtrNull; if (token !== null) { result = token.scratchBuffer || VoidPtrNull; token.scratchBuffer = VoidPtrNull; } else { result = converter.scratchBuffer || VoidPtrNull; converter.scratchBuffer = VoidPtrNull; } return result; } export function _get_args_root_buffer_for_method_call(converter: Converter, token: BoundMethodToken | null): WasmRootBuffer | undefined { if (!converter) return undefined; if (!converter.needs_root_buffer) return undefined; let result = null; if (token !== null) { result = token.scratchRootBuffer; token.scratchRootBuffer = null; } else { result = converter.scratchRootBuffer; converter.scratchRootBuffer = null; } if (result === null) { // TODO: Expand the converter's heap allocation and then use // mono_wasm_new_root_buffer_from_pointer instead. Not that important // at present because the scratch buffer will be reused unless we are // recursing through a re-entrant call result = mono_wasm_new_root_buffer(converter.steps.length); // FIXME (<any>result).converter = converter; } return result; } function _release_args_root_buffer_from_method_call( converter?: Converter, token?: BoundMethodToken | null, argsRootBuffer?: WasmRootBuffer ) { if (!argsRootBuffer || !converter) return; // Store the arguments root buffer for re-use in later calls if (token && (token.scratchRootBuffer === null)) { argsRootBuffer.clear(); token.scratchRootBuffer = argsRootBuffer; } else if (!converter.scratchRootBuffer) { argsRootBuffer.clear(); converter.scratchRootBuffer = argsRootBuffer; } else { argsRootBuffer.release(); } } function _release_buffer_from_method_call( converter: Converter | undefined, token?: BoundMethodToken | null, buffer?: VoidPtr ) { if (!converter || !buffer) return; if (token && !token.scratchBuffer) token.scratchBuffer = buffer; else if (!converter.scratchBuffer) converter.scratchBuffer = coerceNull(buffer); else if (buffer) Module._free(buffer); } function _convert_exception_for_method_call(result: MonoString, exception: MonoObject) { if (exception === MonoObjectNull) return null; const msg = conv_string(result); const err = new Error(msg!); //the convention is that invoke_method ToString () any outgoing exception // console.warn (`error ${msg} at location ${err.stack}); return err; } /* args_marshal is a string with one character per parameter that tells how to marshal it, here are the valid values: i: int32 j: int32 - Enum with underlying type of int32 l: int64 k: int64 - Enum with underlying type of int64 f: float d: double s: string S: interned string o: js object will be converted to a C# object (this will box numbers/bool/promises) m: raw mono object. Don't use it unless you know what you're doing to suppress marshaling of the return value, place '!' at the end of args_marshal, i.e. 'ii!' instead of 'ii' */ export function call_method(method: MonoMethod, this_arg: MonoObject | undefined, args_marshal: string/*ArgsMarshalString*/, args: ArrayLike<any>): any { // HACK: Sometimes callers pass null or undefined, coerce it to 0 since that's what wasm expects this_arg = coerceNull(this_arg); // Detect someone accidentally passing the wrong type of value to method if (typeof method !== "number") throw new Error(`method must be an address in the native heap, but was '${method}'`); if (!method) throw new Error("no method specified"); const needs_converter = _verify_args_for_method_call(args_marshal, args); let buffer = VoidPtrNull, converter = undefined, argsRootBuffer = undefined; let is_result_marshaled = true; // TODO: Only do this if the signature needs marshalling _create_temp_frame(); // check if the method signature needs argument mashalling if (needs_converter) { converter = _compile_converter_for_marshal_string(args_marshal); is_result_marshaled = _decide_if_result_is_marshaled(converter, args.length); argsRootBuffer = _get_args_root_buffer_for_method_call(converter, null); const scratchBuffer = _get_buffer_for_method_call(converter, null); buffer = converter.compiled_variadic_function!(scratchBuffer, argsRootBuffer, method, args); } return _call_method_with_converted_args(method, this_arg!, converter, null, buffer, is_result_marshaled, argsRootBuffer); } export function _handle_exception_for_call( converter: Converter | undefined, token: BoundMethodToken | null, buffer: VoidPtr, resultRoot: WasmRoot<MonoString>, exceptionRoot: WasmRoot<MonoObject>, argsRootBuffer?: WasmRootBuffer ): void { const exc = _convert_exception_for_method_call(resultRoot.value, exceptionRoot.value); if (!exc) return; _teardown_after_call(converter, token, buffer, resultRoot, exceptionRoot, argsRootBuffer); throw exc; } function _handle_exception_and_produce_result_for_call( converter: Converter | undefined, token: BoundMethodToken | null, buffer: VoidPtr, resultRoot: WasmRoot<MonoString>, exceptionRoot: WasmRoot<MonoObject>, argsRootBuffer: WasmRootBuffer | undefined, is_result_marshaled: boolean ): any { _handle_exception_for_call(converter, token, buffer, resultRoot, exceptionRoot, argsRootBuffer); let result: any = resultRoot.value; if (is_result_marshaled) result = _unbox_mono_obj_root(resultRoot); _teardown_after_call(converter, token, buffer, resultRoot, exceptionRoot, argsRootBuffer); return result; } export function _teardown_after_call( converter: Converter | undefined, token: BoundMethodToken | null, buffer: VoidPtr, resultRoot: WasmRoot<any>, exceptionRoot: WasmRoot<any>, argsRootBuffer?: WasmRootBuffer ): void { _release_temp_frame(); _release_args_root_buffer_from_method_call(converter, token, argsRootBuffer); _release_buffer_from_method_call(converter, token, buffer); if (resultRoot) { resultRoot.value = 0; if ((token !== null) && (token.scratchResultRoot === null)) token.scratchResultRoot = resultRoot; else resultRoot.release(); } if (exceptionRoot) { exceptionRoot.value = 0; if ((token !== null) && (token.scratchExceptionRoot === null)) token.scratchExceptionRoot = exceptionRoot; else exceptionRoot.release(); } } function _call_method_with_converted_args( method: MonoMethod, this_arg: MonoObject, converter: Converter | undefined, token: BoundMethodToken | null, buffer: VoidPtr, is_result_marshaled: boolean, argsRootBuffer?: WasmRootBuffer ): any { const resultRoot = mono_wasm_new_root<MonoString>(), exceptionRoot = mono_wasm_new_root<MonoObject>(); resultRoot.value = <any>cwraps.mono_wasm_invoke_method(method, this_arg, buffer, <any>exceptionRoot.get_address()); return _handle_exception_and_produce_result_for_call(converter, token, buffer, resultRoot, exceptionRoot, argsRootBuffer, is_result_marshaled); } export function call_static_method(fqn: string, args: any[], signature: string/*ArgsMarshalString*/): any { bindings_lazy_init();// TODO remove this once Blazor does better startup const method = mono_method_resolve(fqn); if (typeof signature === "undefined") signature = mono_method_get_call_signature(method); return call_method(method, undefined, signature, args); } export function mono_bind_static_method(fqn: string, signature?: string/*ArgsMarshalString*/): Function { bindings_lazy_init();// TODO remove this once Blazor does better startup const method = mono_method_resolve(fqn); if (typeof signature === "undefined") signature = mono_method_get_call_signature(method); return mono_bind_method(method, null, signature!, fqn); } export function mono_bind_assembly_entry_point(assembly: string, signature?: string/*ArgsMarshalString*/): Function { bindings_lazy_init();// TODO remove this once Blazor does better startup const asm = cwraps.mono_wasm_assembly_load(assembly); if (!asm) throw new Error("Could not find assembly: " + assembly); const method = cwraps.mono_wasm_assembly_get_entry_point(asm); if (!method) throw new Error("Could not find entry point for assembly: " + assembly); if (!signature) signature = mono_method_get_call_signature(method); return async function (...args: any[]) { if (args.length > 0 && Array.isArray(args[0])) args[0] = js_array_to_mono_array(args[0], true, false); return call_method(method, undefined, signature!, args); }; } export function mono_call_assembly_entry_point(assembly: string, args?: any[], signature?: string/*ArgsMarshalString*/): number { if (!args) { args = [[]]; } return mono_bind_assembly_entry_point(assembly, signature)(...args); } export function mono_wasm_invoke_js_with_args(js_handle: JSHandle, method_name: MonoString, args: MonoArray, is_exception: Int32Ptr): any { const argsRoot = mono_wasm_new_root(args), nameRoot = mono_wasm_new_root(method_name); try { const js_name = conv_string(nameRoot.value); if (!js_name || (typeof (js_name) !== "string")) { return wrap_error(is_exception, "ERR12: Invalid method name object '" + nameRoot.value + "'"); } const obj = get_js_obj(js_handle); if (!obj) { return wrap_error(is_exception, "ERR13: Invalid JS object handle '" + js_handle + "' while invoking '" + js_name + "'"); } const js_args = _mono_array_root_to_js_array(argsRoot); try { const m = obj[js_name]; if (typeof m === "undefined") throw new Error("Method: '" + js_name + "' not found for: '" + Object.prototype.toString.call(obj) + "'"); const res = m.apply(obj, js_args); return _js_to_mono_obj(true, res); } catch (ex) { return wrap_error(is_exception, ex); } } finally { argsRoot.release(); nameRoot.release(); } } export function mono_wasm_get_object_property(js_handle: JSHandle, property_name: MonoString, is_exception: Int32Ptr): any { const nameRoot = mono_wasm_new_root(property_name); try { const js_name = conv_string(nameRoot.value); if (!js_name) { return wrap_error(is_exception, "Invalid property name object '" + nameRoot.value + "'"); } const obj = mono_wasm_get_jsobj_from_js_handle(js_handle); if (!obj) { return wrap_error(is_exception, "ERR01: Invalid JS object handle '" + js_handle + "' while geting '" + js_name + "'"); } try { const m = obj[js_name]; return _js_to_mono_obj(true, m); } catch (ex) { return wrap_error(is_exception, ex); } } finally { nameRoot.release(); } } export function mono_wasm_set_object_property(js_handle: JSHandle, property_name: MonoString, value: MonoObject, createIfNotExist: boolean, hasOwnProperty: boolean, is_exception: Int32Ptr): MonoObject { const valueRoot = mono_wasm_new_root(value), nameRoot = mono_wasm_new_root(property_name); try { const property = conv_string(nameRoot.value); if (!property) { return wrap_error(is_exception, "Invalid property name object '" + property_name + "'"); } const js_obj = mono_wasm_get_jsobj_from_js_handle(js_handle); if (!js_obj) { return wrap_error(is_exception, "ERR02: Invalid JS object handle '" + js_handle + "' while setting '" + property + "'"); } let result = false; const js_value = _unbox_mono_obj_root(valueRoot); if (createIfNotExist) { js_obj[property] = js_value; result = true; } else { result = false; if (!createIfNotExist) { if (!Object.prototype.hasOwnProperty.call(js_obj, property)) return _box_js_bool(false); } if (hasOwnProperty === true) { if (Object.prototype.hasOwnProperty.call(js_obj, property)) { js_obj[property] = js_value; result = true; } } else { js_obj[property] = js_value; result = true; } } return _box_js_bool(result); } finally { nameRoot.release(); valueRoot.release(); } } export function mono_wasm_get_by_index(js_handle: JSHandle, property_index: number, is_exception: Int32Ptr): MonoObject { const obj = mono_wasm_get_jsobj_from_js_handle(js_handle); if (!obj) { return wrap_error(is_exception, "ERR03: Invalid JS object handle '" + js_handle + "' while getting [" + property_index + "]"); } try { const m = obj[property_index]; return _js_to_mono_obj(true, m); } catch (ex) { return wrap_error(is_exception, ex); } } export function mono_wasm_set_by_index(js_handle: JSHandle, property_index: number, value: MonoObject, is_exception: Int32Ptr): MonoString | true { const valueRoot = mono_wasm_new_root(value); try { const obj = mono_wasm_get_jsobj_from_js_handle(js_handle); if (!obj) { return wrap_error(is_exception, "ERR04: Invalid JS object handle '" + js_handle + "' while setting [" + property_index + "]"); } const js_value = _unbox_mono_obj_root(valueRoot); try { obj[property_index] = js_value; return true;// TODO check } catch (ex) { return wrap_error(is_exception, ex); } } finally { valueRoot.release(); } } export function mono_wasm_get_global_object(global_name: MonoString, is_exception: Int32Ptr): MonoObject { const nameRoot = mono_wasm_new_root(global_name); try { const js_name = conv_string(nameRoot.value); let globalObj; if (!js_name) { globalObj = globalThis; } else { globalObj = (<any>globalThis)[js_name]; } // TODO returning null may be useful when probing for browser features if (globalObj === null || typeof globalObj === undefined) { return wrap_error(is_exception, "Global object '" + js_name + "' not found."); } return _js_to_mono_obj(true, globalObj); } finally { nameRoot.release(); } } // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export function wrap_error(is_exception: Int32Ptr | null, ex: any): MonoString { let res = "unknown exception"; if (ex) { res = ex.toString(); const stack = ex.stack; if (stack) { // Some JS runtimes insert the error message at the top of the stack, some don't, // so normalize it by using the stack as the result if it already contains the error if (stack.startsWith(res)) res = stack; else res += "\n" + stack; } } if (is_exception) { Module.setValue(is_exception, 1, "i32"); } return js_string_to_mono_string(res)!; } export function mono_method_get_call_signature(method: MonoMethod, mono_obj?: MonoObject): string/*ArgsMarshalString*/ { const instanceRoot = mono_wasm_new_root(mono_obj); try { return call_method(runtimeHelpers.get_call_sig, undefined, "im", [method, instanceRoot.value]); } finally { instanceRoot.release(); } } export function mono_method_resolve(fqn: string): MonoMethod { const assembly = fqn.substring(fqn.indexOf("[") + 1, fqn.indexOf("]")).trim(); fqn = fqn.substring(fqn.indexOf("]") + 1).trim(); const methodname = fqn.substring(fqn.indexOf(":") + 1); fqn = fqn.substring(0, fqn.indexOf(":")).trim(); let namespace = ""; let classname = fqn; if (fqn.indexOf(".") != -1) { const idx = fqn.lastIndexOf("."); namespace = fqn.substring(0, idx); classname = fqn.substring(idx + 1); } if (!assembly.trim()) throw new Error("No assembly name specified"); if (!classname.trim()) throw new Error("No class name specified"); if (!methodname.trim()) throw new Error("No method name specified"); const asm = cwraps.mono_wasm_assembly_load(assembly); if (!asm) throw new Error("Could not find assembly: " + assembly); const klass = cwraps.mono_wasm_assembly_find_class(asm, namespace, classname); if (!klass) throw new Error("Could not find class: " + namespace + ":" + classname + " in assembly " + assembly); const method = find_method(klass, methodname, -1); if (!method) throw new Error("Could not find method: " + methodname); return method; } // Blazor specific custom routine // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export function mono_wasm_invoke_js_blazor(exceptionMessage: Int32Ptr, callInfo: any, arg0: any, arg1: any, arg2: any): void | number { try { const blazorExports = (<any>globalThis).Blazor; if (!blazorExports) { throw new Error("The blazor.webassembly.js library is not loaded."); } return blazorExports._internal.invokeJSFromDotNet(callInfo, arg0, arg1, arg2); } catch (ex: any) { const exceptionJsString = ex.message + "\n" + ex.stack; const exceptionSystemString = cwraps.mono_wasm_string_from_js(exceptionJsString); Module.setValue(exceptionMessage, <any>exceptionSystemString, "i32"); // *exceptionMessage = exceptionSystemString; return 0; } } // code like `App.call_test_method();` export function mono_wasm_invoke_js(code: MonoString, is_exception: Int32Ptr): MonoString | null { if (code === MonoStringNull) return MonoStringNull; const js_code = conv_string(code)!; try { const closedEval = function (Module: EmscriptenModule, MONO: any, BINDING: any, INTERNAL: any, code: string) { return eval(code); }; const res = closedEval(Module, MONO, BINDING, INTERNAL, js_code); Module.setValue(is_exception, 0, "i32"); if (typeof res === "undefined" || res === null) return MonoStringNull; return js_string_to_mono_string(res.toString()); } catch (ex) { return wrap_error(is_exception, ex); } } // TODO is this unused code ? // Compiles a JavaScript function from the function data passed. // Note: code snippet is not a function definition. Instead it must create and return a function instance. // code like `return function() { App.call_test_method(); };` export function mono_wasm_compile_function(code: MonoString, is_exception: Int32Ptr): MonoObject { if (code === MonoStringNull) return MonoStringNull; const js_code = conv_string(code); try { const closure = { Module, MONO, BINDING, INTERNAL }; const fn_body_template = `const {Module, MONO, BINDING, INTERNAL} = __closure; ${js_code} ;`; const fn_defn = new Function("__closure", fn_body_template); const res = fn_defn(closure); if (!res || typeof res !== "function") return wrap_error(is_exception, "Code must return an instance of a JavaScript function. Please use `return` statement to return a function."); Module.setValue(is_exception, 0, "i32"); return _js_to_mono_obj(true, res); } catch (ex) { return wrap_error(is_exception, ex); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. import { mono_wasm_new_root, mono_wasm_new_root_buffer, WasmRoot, WasmRootBuffer } from "./roots"; import { JSHandle, MonoArray, MonoMethod, MonoObject, MonoObjectNull, MonoString, coerceNull as coerceNull, VoidPtrNull, MonoStringNull } from "./types"; import { BINDING, INTERNAL, Module, MONO, runtimeHelpers } from "./imports"; import { _mono_array_root_to_js_array, _unbox_mono_obj_root } from "./cs-to-js"; import { get_js_obj, mono_wasm_get_jsobj_from_js_handle } from "./gc-handles"; import { js_array_to_mono_array, _box_js_bool, _js_to_mono_obj } from "./js-to-cs"; import { mono_bind_method, Converter, _compile_converter_for_marshal_string, _decide_if_result_is_marshaled, find_method, BoundMethodToken } from "./method-binding"; import { conv_string, js_string_to_mono_string } from "./strings"; import cwraps from "./cwraps"; import { bindings_lazy_init } from "./startup"; import { _create_temp_frame, _release_temp_frame } from "./memory"; import { VoidPtr, Int32Ptr, EmscriptenModule } from "./types/emscripten"; function _verify_args_for_method_call(args_marshal: string/*ArgsMarshalString*/, args: any) { const has_args = args && (typeof args === "object") && args.length > 0; const has_args_marshal = typeof args_marshal === "string"; if (has_args) { if (!has_args_marshal) throw new Error("No signature provided for method call."); else if (args.length > args_marshal.length) throw new Error("Too many parameter values. Expected at most " + args_marshal.length + " value(s) for signature " + args_marshal); } return has_args_marshal && has_args; } export function _get_buffer_for_method_call(converter: Converter, token: BoundMethodToken | null): VoidPtr | undefined { if (!converter) return VoidPtrNull; let result = VoidPtrNull; if (token !== null) { result = token.scratchBuffer || VoidPtrNull; token.scratchBuffer = VoidPtrNull; } else { result = converter.scratchBuffer || VoidPtrNull; converter.scratchBuffer = VoidPtrNull; } return result; } export function _get_args_root_buffer_for_method_call(converter: Converter, token: BoundMethodToken | null): WasmRootBuffer | undefined { if (!converter) return undefined; if (!converter.needs_root_buffer) return undefined; let result = null; if (token !== null) { result = token.scratchRootBuffer; token.scratchRootBuffer = null; } else { result = converter.scratchRootBuffer; converter.scratchRootBuffer = null; } if (result === null) { // TODO: Expand the converter's heap allocation and then use // mono_wasm_new_root_buffer_from_pointer instead. Not that important // at present because the scratch buffer will be reused unless we are // recursing through a re-entrant call result = mono_wasm_new_root_buffer(converter.steps.length); // FIXME (<any>result).converter = converter; } return result; } function _release_args_root_buffer_from_method_call( converter?: Converter, token?: BoundMethodToken | null, argsRootBuffer?: WasmRootBuffer ) { if (!argsRootBuffer || !converter) return; // Store the arguments root buffer for re-use in later calls if (token && (token.scratchRootBuffer === null)) { argsRootBuffer.clear(); token.scratchRootBuffer = argsRootBuffer; } else if (!converter.scratchRootBuffer) { argsRootBuffer.clear(); converter.scratchRootBuffer = argsRootBuffer; } else { argsRootBuffer.release(); } } function _release_buffer_from_method_call( converter: Converter | undefined, token?: BoundMethodToken | null, buffer?: VoidPtr ) { if (!converter || !buffer) return; if (token && !token.scratchBuffer) token.scratchBuffer = buffer; else if (!converter.scratchBuffer) converter.scratchBuffer = coerceNull(buffer); else if (buffer) Module._free(buffer); } function _convert_exception_for_method_call(result: MonoString, exception: MonoObject) { if (exception === MonoObjectNull) return null; const msg = conv_string(result); const err = new Error(msg!); //the convention is that invoke_method ToString () any outgoing exception // console.warn (`error ${msg} at location ${err.stack}); return err; } /* args_marshal is a string with one character per parameter that tells how to marshal it, here are the valid values: i: int32 j: int32 - Enum with underlying type of int32 l: int64 k: int64 - Enum with underlying type of int64 f: float d: double s: string S: interned string o: js object will be converted to a C# object (this will box numbers/bool/promises) m: raw mono object. Don't use it unless you know what you're doing to suppress marshaling of the return value, place '!' at the end of args_marshal, i.e. 'ii!' instead of 'ii' */ export function call_method(method: MonoMethod, this_arg: MonoObject | undefined, args_marshal: string/*ArgsMarshalString*/, args: ArrayLike<any>): any { // HACK: Sometimes callers pass null or undefined, coerce it to 0 since that's what wasm expects this_arg = coerceNull(this_arg); // Detect someone accidentally passing the wrong type of value to method if (typeof method !== "number") throw new Error(`method must be an address in the native heap, but was '${method}'`); if (!method) throw new Error("no method specified"); const needs_converter = _verify_args_for_method_call(args_marshal, args); let buffer = VoidPtrNull, converter = undefined, argsRootBuffer = undefined; let is_result_marshaled = true; // TODO: Only do this if the signature needs marshalling _create_temp_frame(); // check if the method signature needs argument mashalling if (needs_converter) { converter = _compile_converter_for_marshal_string(args_marshal); is_result_marshaled = _decide_if_result_is_marshaled(converter, args.length); argsRootBuffer = _get_args_root_buffer_for_method_call(converter, null); const scratchBuffer = _get_buffer_for_method_call(converter, null); buffer = converter.compiled_variadic_function!(scratchBuffer, argsRootBuffer, method, args); } return _call_method_with_converted_args(method, this_arg!, converter, null, buffer, is_result_marshaled, argsRootBuffer); } export function _handle_exception_for_call( converter: Converter | undefined, token: BoundMethodToken | null, buffer: VoidPtr, resultRoot: WasmRoot<MonoString>, exceptionRoot: WasmRoot<MonoObject>, argsRootBuffer?: WasmRootBuffer ): void { const exc = _convert_exception_for_method_call(resultRoot.value, exceptionRoot.value); if (!exc) return; _teardown_after_call(converter, token, buffer, resultRoot, exceptionRoot, argsRootBuffer); throw exc; } function _handle_exception_and_produce_result_for_call( converter: Converter | undefined, token: BoundMethodToken | null, buffer: VoidPtr, resultRoot: WasmRoot<MonoString>, exceptionRoot: WasmRoot<MonoObject>, argsRootBuffer: WasmRootBuffer | undefined, is_result_marshaled: boolean ): any { _handle_exception_for_call(converter, token, buffer, resultRoot, exceptionRoot, argsRootBuffer); let result: any = resultRoot.value; if (is_result_marshaled) result = _unbox_mono_obj_root(resultRoot); _teardown_after_call(converter, token, buffer, resultRoot, exceptionRoot, argsRootBuffer); return result; } export function _teardown_after_call( converter: Converter | undefined, token: BoundMethodToken | null, buffer: VoidPtr, resultRoot: WasmRoot<any>, exceptionRoot: WasmRoot<any>, argsRootBuffer?: WasmRootBuffer ): void { _release_temp_frame(); _release_args_root_buffer_from_method_call(converter, token, argsRootBuffer); _release_buffer_from_method_call(converter, token, buffer); if (resultRoot) { resultRoot.value = 0; if ((token !== null) && (token.scratchResultRoot === null)) token.scratchResultRoot = resultRoot; else resultRoot.release(); } if (exceptionRoot) { exceptionRoot.value = 0; if ((token !== null) && (token.scratchExceptionRoot === null)) token.scratchExceptionRoot = exceptionRoot; else exceptionRoot.release(); } } function _call_method_with_converted_args( method: MonoMethod, this_arg: MonoObject, converter: Converter | undefined, token: BoundMethodToken | null, buffer: VoidPtr, is_result_marshaled: boolean, argsRootBuffer?: WasmRootBuffer ): any { const resultRoot = mono_wasm_new_root<MonoString>(), exceptionRoot = mono_wasm_new_root<MonoObject>(); resultRoot.value = <any>cwraps.mono_wasm_invoke_method(method, this_arg, buffer, <any>exceptionRoot.get_address()); return _handle_exception_and_produce_result_for_call(converter, token, buffer, resultRoot, exceptionRoot, argsRootBuffer, is_result_marshaled); } export function call_static_method(fqn: string, args: any[], signature: string/*ArgsMarshalString*/): any { bindings_lazy_init();// TODO remove this once Blazor does better startup const method = mono_method_resolve(fqn); if (typeof signature === "undefined") signature = mono_method_get_call_signature(method); return call_method(method, undefined, signature, args); } export function mono_bind_static_method(fqn: string, signature?: string/*ArgsMarshalString*/): Function { bindings_lazy_init();// TODO remove this once Blazor does better startup const method = mono_method_resolve(fqn); if (typeof signature === "undefined") signature = mono_method_get_call_signature(method); return mono_bind_method(method, null, signature!, fqn); } export function mono_bind_assembly_entry_point(assembly: string, signature?: string/*ArgsMarshalString*/): Function { bindings_lazy_init();// TODO remove this once Blazor does better startup const asm = cwraps.mono_wasm_assembly_load(assembly); if (!asm) throw new Error("Could not find assembly: " + assembly); const method = cwraps.mono_wasm_assembly_get_entry_point(asm); if (!method) throw new Error("Could not find entry point for assembly: " + assembly); if (!signature) signature = mono_method_get_call_signature(method); return async function (...args: any[]) { if (args.length > 0 && Array.isArray(args[0])) args[0] = js_array_to_mono_array(args[0], true, false); return call_method(method, undefined, signature!, args); }; } export function mono_call_assembly_entry_point(assembly: string, args?: any[], signature?: string/*ArgsMarshalString*/): number { if (!args) { args = [[]]; } return mono_bind_assembly_entry_point(assembly, signature)(...args); } export function mono_wasm_invoke_js_with_args(js_handle: JSHandle, method_name: MonoString, args: MonoArray, is_exception: Int32Ptr): any { const argsRoot = mono_wasm_new_root(args), nameRoot = mono_wasm_new_root(method_name); try { const js_name = conv_string(nameRoot.value); if (!js_name || (typeof (js_name) !== "string")) { return wrap_error(is_exception, "ERR12: Invalid method name object '" + nameRoot.value + "'"); } const obj = get_js_obj(js_handle); if (!obj) { return wrap_error(is_exception, "ERR13: Invalid JS object handle '" + js_handle + "' while invoking '" + js_name + "'"); } const js_args = _mono_array_root_to_js_array(argsRoot); try { const m = obj[js_name]; if (typeof m === "undefined") throw new Error("Method: '" + js_name + "' not found for: '" + Object.prototype.toString.call(obj) + "'"); const res = m.apply(obj, js_args); return _js_to_mono_obj(true, res); } catch (ex) { return wrap_error(is_exception, ex); } } finally { argsRoot.release(); nameRoot.release(); } } export function mono_wasm_get_object_property(js_handle: JSHandle, property_name: MonoString, is_exception: Int32Ptr): any { const nameRoot = mono_wasm_new_root(property_name); try { const js_name = conv_string(nameRoot.value); if (!js_name) { return wrap_error(is_exception, "Invalid property name object '" + nameRoot.value + "'"); } const obj = mono_wasm_get_jsobj_from_js_handle(js_handle); if (!obj) { return wrap_error(is_exception, "ERR01: Invalid JS object handle '" + js_handle + "' while geting '" + js_name + "'"); } try { const m = obj[js_name]; return _js_to_mono_obj(true, m); } catch (ex) { return wrap_error(is_exception, ex); } } finally { nameRoot.release(); } } export function mono_wasm_set_object_property(js_handle: JSHandle, property_name: MonoString, value: MonoObject, createIfNotExist: boolean, hasOwnProperty: boolean, is_exception: Int32Ptr): MonoObject { const valueRoot = mono_wasm_new_root(value), nameRoot = mono_wasm_new_root(property_name); try { const property = conv_string(nameRoot.value); if (!property) { return wrap_error(is_exception, "Invalid property name object '" + property_name + "'"); } const js_obj = mono_wasm_get_jsobj_from_js_handle(js_handle); if (!js_obj) { return wrap_error(is_exception, "ERR02: Invalid JS object handle '" + js_handle + "' while setting '" + property + "'"); } let result = false; const js_value = _unbox_mono_obj_root(valueRoot); if (createIfNotExist) { js_obj[property] = js_value; result = true; } else { result = false; if (!createIfNotExist) { if (!Object.prototype.hasOwnProperty.call(js_obj, property)) return _box_js_bool(false); } if (hasOwnProperty === true) { if (Object.prototype.hasOwnProperty.call(js_obj, property)) { js_obj[property] = js_value; result = true; } } else { js_obj[property] = js_value; result = true; } } return _box_js_bool(result); } finally { nameRoot.release(); valueRoot.release(); } } export function mono_wasm_get_by_index(js_handle: JSHandle, property_index: number, is_exception: Int32Ptr): MonoObject { const obj = mono_wasm_get_jsobj_from_js_handle(js_handle); if (!obj) { return wrap_error(is_exception, "ERR03: Invalid JS object handle '" + js_handle + "' while getting [" + property_index + "]"); } try { const m = obj[property_index]; return _js_to_mono_obj(true, m); } catch (ex) { return wrap_error(is_exception, ex); } } export function mono_wasm_set_by_index(js_handle: JSHandle, property_index: number, value: MonoObject, is_exception: Int32Ptr): MonoString | true { const valueRoot = mono_wasm_new_root(value); try { const obj = mono_wasm_get_jsobj_from_js_handle(js_handle); if (!obj) { return wrap_error(is_exception, "ERR04: Invalid JS object handle '" + js_handle + "' while setting [" + property_index + "]"); } const js_value = _unbox_mono_obj_root(valueRoot); try { obj[property_index] = js_value; return true;// TODO check } catch (ex) { return wrap_error(is_exception, ex); } } finally { valueRoot.release(); } } export function mono_wasm_get_global_object(global_name: MonoString, is_exception: Int32Ptr): MonoObject { const nameRoot = mono_wasm_new_root(global_name); try { const js_name = conv_string(nameRoot.value); let globalObj; if (!js_name) { globalObj = globalThis; } else { globalObj = (<any>globalThis)[js_name]; } // TODO returning null may be useful when probing for browser features if (globalObj === null || typeof globalObj === undefined) { return wrap_error(is_exception, "Global object '" + js_name + "' not found."); } return _js_to_mono_obj(true, globalObj); } finally { nameRoot.release(); } } // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export function wrap_error(is_exception: Int32Ptr | null, ex: any): MonoString { let res = "unknown exception"; if (ex) { res = ex.toString(); const stack = ex.stack; if (stack) { // Some JS runtimes insert the error message at the top of the stack, some don't, // so normalize it by using the stack as the result if it already contains the error if (stack.startsWith(res)) res = stack; else res += "\n" + stack; } res = INTERNAL.mono_wasm_symbolicate_string(res); } if (is_exception) { Module.setValue(is_exception, 1, "i32"); } return js_string_to_mono_string(res)!; } export function mono_method_get_call_signature(method: MonoMethod, mono_obj?: MonoObject): string/*ArgsMarshalString*/ { const instanceRoot = mono_wasm_new_root(mono_obj); try { return call_method(runtimeHelpers.get_call_sig, undefined, "im", [method, instanceRoot.value]); } finally { instanceRoot.release(); } } export function mono_method_resolve(fqn: string): MonoMethod { const assembly = fqn.substring(fqn.indexOf("[") + 1, fqn.indexOf("]")).trim(); fqn = fqn.substring(fqn.indexOf("]") + 1).trim(); const methodname = fqn.substring(fqn.indexOf(":") + 1); fqn = fqn.substring(0, fqn.indexOf(":")).trim(); let namespace = ""; let classname = fqn; if (fqn.indexOf(".") != -1) { const idx = fqn.lastIndexOf("."); namespace = fqn.substring(0, idx); classname = fqn.substring(idx + 1); } if (!assembly.trim()) throw new Error("No assembly name specified"); if (!classname.trim()) throw new Error("No class name specified"); if (!methodname.trim()) throw new Error("No method name specified"); const asm = cwraps.mono_wasm_assembly_load(assembly); if (!asm) throw new Error("Could not find assembly: " + assembly); const klass = cwraps.mono_wasm_assembly_find_class(asm, namespace, classname); if (!klass) throw new Error("Could not find class: " + namespace + ":" + classname + " in assembly " + assembly); const method = find_method(klass, methodname, -1); if (!method) throw new Error("Could not find method: " + methodname); return method; } // Blazor specific custom routine // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export function mono_wasm_invoke_js_blazor(exceptionMessage: Int32Ptr, callInfo: any, arg0: any, arg1: any, arg2: any): void | number { try { const blazorExports = (<any>globalThis).Blazor; if (!blazorExports) { throw new Error("The blazor.webassembly.js library is not loaded."); } return blazorExports._internal.invokeJSFromDotNet(callInfo, arg0, arg1, arg2); } catch (ex: any) { const exceptionJsString = ex.message + "\n" + ex.stack; const exceptionSystemString = cwraps.mono_wasm_string_from_js(exceptionJsString); Module.setValue(exceptionMessage, <any>exceptionSystemString, "i32"); // *exceptionMessage = exceptionSystemString; return 0; } } // code like `App.call_test_method();` export function mono_wasm_invoke_js(code: MonoString, is_exception: Int32Ptr): MonoString | null { if (code === MonoStringNull) return MonoStringNull; const js_code = conv_string(code)!; try { const closedEval = function (Module: EmscriptenModule, MONO: any, BINDING: any, INTERNAL: any, code: string) { return eval(code); }; const res = closedEval(Module, MONO, BINDING, INTERNAL, js_code); Module.setValue(is_exception, 0, "i32"); if (typeof res === "undefined" || res === null) return MonoStringNull; return js_string_to_mono_string(res.toString()); } catch (ex) { return wrap_error(is_exception, ex); } } // TODO is this unused code ? // Compiles a JavaScript function from the function data passed. // Note: code snippet is not a function definition. Instead it must create and return a function instance. // code like `return function() { App.call_test_method(); };` export function mono_wasm_compile_function(code: MonoString, is_exception: Int32Ptr): MonoObject { if (code === MonoStringNull) return MonoStringNull; const js_code = conv_string(code); try { const closure = { Module, MONO, BINDING, INTERNAL }; const fn_body_template = `const {Module, MONO, BINDING, INTERNAL} = __closure; ${js_code} ;`; const fn_defn = new Function("__closure", fn_body_template); const res = fn_defn(closure); if (!res || typeof res !== "function") return wrap_error(is_exception, "Code must return an instance of a JavaScript function. Please use `return` statement to return a function."); Module.setValue(is_exception, 0, "i32"); return _js_to_mono_obj(true, res); } catch (ex) { return wrap_error(is_exception, ex); } }
1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/mono/wasm/runtime/run.ts
import { ExitStatus, Module, quit } from "./imports"; import { mono_call_assembly_entry_point } from "./method-calls"; import { mono_wasm_set_main_args, runtime_is_initialized_reject } from "./startup"; export async function mono_run_main_and_exit(main_assembly_name: string, args: string[]): Promise<void> { try { const result = await mono_run_main(main_assembly_name, args); set_exit_code(result); } catch (error) { if (error instanceof ExitStatus) { return; } set_exit_code(1, error); } } export async function mono_run_main(main_assembly_name: string, args: string[]): Promise<number> { mono_wasm_set_main_args(main_assembly_name, args); return mono_call_assembly_entry_point(main_assembly_name, [args], "m"); } // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export function mono_on_abort(error: any): void { runtime_is_initialized_reject(error); set_exit_code(1, error); } function set_exit_code(exit_code: number, reason?: any) { if (reason && !(reason instanceof ExitStatus)) { Module.printErr(reason.toString()); if (reason.stack) { Module.printErr(reason.stack); } } else { reason = new ExitStatus(exit_code); } quit(exit_code, reason); }
import { ExitStatus, INTERNAL, Module, quit } from "./imports"; import { mono_call_assembly_entry_point } from "./method-calls"; import { mono_wasm_set_main_args, runtime_is_initialized_reject } from "./startup"; export async function mono_run_main_and_exit(main_assembly_name: string, args: string[]): Promise<void> { try { const result = await mono_run_main(main_assembly_name, args); set_exit_code(result); } catch (error) { if (error instanceof ExitStatus) { return; } set_exit_code(1, error); } } export async function mono_run_main(main_assembly_name: string, args: string[]): Promise<number> { mono_wasm_set_main_args(main_assembly_name, args); return mono_call_assembly_entry_point(main_assembly_name, [args], "m"); } // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export function mono_on_abort(error: any): void { runtime_is_initialized_reject(error); set_exit_code(1, error); } function set_exit_code(exit_code: number, reason?: any) { if (reason && !(reason instanceof ExitStatus)) { if (reason instanceof Error) Module.printErr(INTERNAL.mono_wasm_stringify_as_error_with_stack(reason)); else if (typeof reason == "string") Module.printErr(reason); else Module.printErr(JSON.stringify(reason)); } else { reason = new ExitStatus(exit_code); } quit(exit_code, reason); }
1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/mono/wasm/runtime/types/emscripten.ts
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. export declare interface ManagedPointer { __brandManagedPointer: "ManagedPointer" } export declare interface NativePointer { __brandNativePointer: "NativePointer" } export declare interface VoidPtr extends NativePointer { __brand: "VoidPtr" } export declare interface CharPtr extends NativePointer { __brand: "CharPtr" } export declare interface Int32Ptr extends NativePointer { __brand: "Int32Ptr" } export declare interface CharPtrPtr extends NativePointer { __brand: "CharPtrPtr" } export declare interface EmscriptenModule { HEAP8: Int8Array, HEAP16: Int16Array; HEAP32: Int32Array; HEAPU8: Uint8Array; HEAPU16: Uint16Array; HEAPU32: Uint32Array; HEAPF32: Float32Array; HEAPF64: Float64Array; // this should match emcc -s EXPORTED_FUNCTIONS _malloc(size: number): VoidPtr; _free(ptr: VoidPtr): void; // this should match emcc -s EXPORTED_RUNTIME_METHODS print(message: string): void; printErr(message: string): void; ccall<T>(ident: string, returnType?: string | null, argTypes?: string[], args?: any[], opts?: any): T; cwrap<T extends Function>(ident: string, returnType: string, argTypes?: string[], opts?: any): T; cwrap<T extends Function>(ident: string, ...args: any[]): T; setValue(ptr: VoidPtr, value: number, type: string, noSafe?: number | boolean): void; setValue(ptr: Int32Ptr, value: number, type: string, noSafe?: number | boolean): void; getValue(ptr: number, type: string, noSafe?: number | boolean): number; UTF8ToString(ptr: CharPtr, maxBytesToRead?: number): string; UTF8ArrayToString(u8Array: Uint8Array, idx?: number, maxBytesToRead?: number): string; FS_createPath(parent: string, path: string, canRead?: boolean, canWrite?: boolean): string; FS_createDataFile(parent: string, name: string, data: TypedArray, canRead: boolean, canWrite: boolean, canOwn?: boolean): string; removeRunDependency(id: string): void; addRunDependency(id: string): void; ready: Promise<unknown>; preInit?: (() => any)[]; preRun?: (() => any)[]; postRun?: (() => any)[]; onAbort?: { (error: any): void }; onRuntimeInitialized?: () => any; instantiateWasm: (imports: any, successCallback: Function) => any; } export declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. export declare interface ManagedPointer { __brandManagedPointer: "ManagedPointer" } export declare interface NativePointer { __brandNativePointer: "NativePointer" } export declare interface VoidPtr extends NativePointer { __brand: "VoidPtr" } export declare interface CharPtr extends NativePointer { __brand: "CharPtr" } export declare interface Int32Ptr extends NativePointer { __brand: "Int32Ptr" } export declare interface CharPtrPtr extends NativePointer { __brand: "CharPtrPtr" } export declare interface EmscriptenModule { HEAP8: Int8Array, HEAP16: Int16Array; HEAP32: Int32Array; HEAPU8: Uint8Array; HEAPU16: Uint16Array; HEAPU32: Uint32Array; HEAPF32: Float32Array; HEAPF64: Float64Array; // this should match emcc -s EXPORTED_FUNCTIONS _malloc(size: number): VoidPtr; _free(ptr: VoidPtr): void; // this should match emcc -s EXPORTED_RUNTIME_METHODS print(message: string): void; printErr(message: string): void; ccall<T>(ident: string, returnType?: string | null, argTypes?: string[], args?: any[], opts?: any): T; cwrap<T extends Function>(ident: string, returnType: string, argTypes?: string[], opts?: any): T; cwrap<T extends Function>(ident: string, ...args: any[]): T; setValue(ptr: VoidPtr, value: number, type: string, noSafe?: number | boolean): void; setValue(ptr: Int32Ptr, value: number, type: string, noSafe?: number | boolean): void; getValue(ptr: number, type: string, noSafe?: number | boolean): number; UTF8ToString(ptr: CharPtr, maxBytesToRead?: number): string; UTF8ArrayToString(u8Array: Uint8Array, idx?: number, maxBytesToRead?: number): string; FS_createPath(parent: string, path: string, canRead?: boolean, canWrite?: boolean): string; FS_createDataFile(parent: string, name: string, data: TypedArray, canRead: boolean, canWrite: boolean, canOwn?: boolean): string; FS_readFile(filename: string, opts: any): any; removeRunDependency(id: string): void; addRunDependency(id: string): void; ready: Promise<unknown>; preInit?: (() => any)[]; preRun?: (() => any)[]; postRun?: (() => any)[]; onAbort?: { (error: any): void }; onRuntimeInitialized?: () => any; instantiateWasm: (imports: any, successCallback: Function) => any; } export declare type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/mono/wasm/test-main.js
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // -*- mode: js; js-indent-level: 4; -*- // // Run runtime tests under a JS shell or a browser // "use strict"; //glue code to deal with the differences between chrome, ch, d8, jsc and sm. const is_browser = typeof window != "undefined"; const is_node = !is_browser && typeof process === 'object' && typeof process.versions === 'object' && typeof process.versions.node === 'string'; if (is_node && process.versions.node.split(".")[0] < 14) { throw new Error(`NodeJS at '${process.execPath}' has too low version '${process.versions.node}'`); } // if the engine doesn't provide a console if (typeof (console) === "undefined") { globalThis.console = { log: globalThis.print, clear: function () { } }; } const originalConsole = { log: console.log, error: console.error }; function proxyConsoleMethod(prefix, func, asJson) { return function () { try { const args = [...arguments]; let payload = args[0]; if (payload === undefined) payload = 'undefined'; else if (payload === null) payload = 'null'; else if (typeof payload === 'function') payload = payload.toString(); else if (typeof payload !== 'string') { try { payload = JSON.stringify(payload); } catch (e) { payload = payload.toString(); } } if (payload.startsWith("STARTRESULTXML")) { originalConsole.log('Sending RESULTXML') func(payload); } else if (asJson) { func(JSON.stringify({ method: prefix, payload: payload, arguments: args })); } else { func([prefix + payload, ...args.slice(1)]); } } catch (err) { originalConsole.error(`proxyConsole failed: ${err}`) } }; }; const methods = ["debug", "trace", "warn", "info", "error"]; for (let m of methods) { if (typeof (console[m]) !== "function") { console[m] = proxyConsoleMethod(`console.${m}: `, console.log, false); } } let consoleWebSocket; if (is_browser) { const consoleUrl = `${window.location.origin}/console`.replace('http://', 'ws://'); consoleWebSocket = new WebSocket(consoleUrl); consoleWebSocket.onopen = function (event) { originalConsole.log("browser: Console websocket connected."); }; consoleWebSocket.onerror = function (event) { originalConsole.error(`websocket error: ${event}`); }; consoleWebSocket.onclose = function (event) { originalConsole.error(`websocket closed: ${event}`); }; const send = (msg) => { if (consoleWebSocket.readyState === WebSocket.OPEN) { consoleWebSocket.send(msg); } else { originalConsole.log(msg); } } // redirect output early, so that when emscripten starts it's already redirected for (let m of ["log", ...methods]) console[m] = proxyConsoleMethod(`console.${m}`, send, true); } if (typeof globalThis.crypto === 'undefined') { // **NOTE** this is a simple insecure polyfill for testing purposes only // /dev/random doesn't work on js shells, so define our own // See library_fs.js:createDefaultDevices () globalThis.crypto = { getRandomValues: function (buffer) { for (let i = 0; i < buffer.length; i++) buffer[i] = (Math.random() * 256) | 0; } } } if (typeof globalThis.performance === 'undefined') { if (is_node) { const { performance } = require("perf_hooks"); globalThis.performance = performance; } else { // performance.now() is used by emscripten and doesn't work in JSC globalThis.performance = { now: function () { return Date.now(); } } } } loadDotnet("./dotnet.js").then((createDotnetRuntime) => { return createDotnetRuntime(({ MONO, INTERNAL, BINDING, Module }) => ({ disableDotnet6Compatibility: true, config: null, configSrc: "./mono-config.json", onConfigLoaded: (config) => { if (!Module.config) { const err = new Error("Could not find ./mono-config.json. Cancelling run"); set_exit_code(1); throw err; } // Have to set env vars here to enable setting MONO_LOG_LEVEL etc. for (let variable in processedArguments.setenv) { config.environment_variables[variable] = processedArguments.setenv[variable]; } config.diagnostic_tracing = !!processedArguments.diagnostic_tracing; }, preRun: () => { if (!processedArguments.enable_gc) { INTERNAL.mono_wasm_enable_on_demand_gc(0); } }, onDotnetReady: () => { let wds = Module.FS.stat(processedArguments.working_dir); if (wds === undefined || !Module.FS.isDir(wds.mode)) { set_exit_code(1, `Could not find working directory ${processedArguments.working_dir}`); return; } Module.FS.chdir(processedArguments.working_dir); App.init({ MONO, INTERNAL, BINDING, Module }); }, onAbort: (error) => { console.log("ABORT: " + error); const err = new Error(); console.log("Stacktrace: \n"); console.error(err.stack); set_exit_code(1, error); }, })) }).catch(function (err) { console.error(err); set_exit_code(1, "failed to load the dotnet.js file.\n" + err); }); const App = { init: async function ({ MONO, INTERNAL, BINDING, Module }) { console.info("Initializing....."); Object.assign(App, { MONO, INTERNAL, BINDING, Module }); for (let i = 0; i < processedArguments.profilers.length; ++i) { const init = Module.cwrap('mono_wasm_load_profiler_' + processedArguments.profilers[i], 'void', ['string']); init(""); } if (processedArguments.applicationArgs.length == 0) { set_exit_code(1, "Missing required --run argument"); return; } if (processedArguments.applicationArgs[0] == "--regression") { const exec_regression = Module.cwrap('mono_wasm_exec_regression', 'number', ['number', 'string']); let res = 0; try { res = exec_regression(10, processedArguments.applicationArgs[1]); console.log("REGRESSION RESULT: " + res); } catch (e) { console.error("ABORT: " + e); console.error(e.stack); res = 1; } if (res) set_exit_code(1, "REGRESSION TEST FAILED"); return; } if (processedArguments.runtime_args.length > 0) INTERNAL.mono_wasm_set_runtime_options(processedArguments.runtime_args); if (processedArguments.applicationArgs[0] == "--run") { // Run an exe if (processedArguments.applicationArgs.length == 1) { set_exit_code(1, "Error: Missing main executable argument."); return; } try { const main_assembly_name = processedArguments.applicationArgs[1]; const app_args = processedArguments.applicationArgs.slice(2); const result = await MONO.mono_run_main(main_assembly_name, app_args); set_exit_code(result); } catch (error) { if (error.name != "ExitStatus") { set_exit_code(1, error); } } } else { set_exit_code(1, "Unhandled argument: " + processedArguments.applicationArgs[0]); } }, /** Runs a particular test * @type {(method_name: string, args: any[]=, signature: any=) => return number} */ call_test_method: function (method_name, args, signature) { // note: arguments here is the array of arguments passsed to this function if ((arguments.length > 2) && (typeof (signature) !== "string")) throw new Error("Invalid number of arguments for call_test_method"); const fqn = "[System.Private.Runtime.InteropServices.JavaScript.Tests]System.Runtime.InteropServices.JavaScript.Tests.HelperMarshal:" + method_name; try { return App.INTERNAL.call_static_method(fqn, args || [], signature); } catch (exc) { console.error("exception thrown in", fqn); throw exc; } } }; globalThis.App = App; // Necessary as System.Runtime.InteropServices.JavaScript.Tests.MarshalTests (among others) call the App.call_test_method directly function set_exit_code(exit_code, reason) { if (reason) { console.error(`${JSON.stringify(reason)}`); if (reason.stack) { console.error(reason.stack); } } if (is_browser) { if (App.Module) { // Notify the selenium script App.Module.exit_code = exit_code; } //Tell xharness WasmBrowserTestRunner what was the exit code const tests_done_elem = document.createElement("label"); tests_done_elem.id = "tests_done"; tests_done_elem.innerHTML = exit_code.toString(); document.body.appendChild(tests_done_elem); const stop_when_ws_buffer_empty = () => { if (consoleWebSocket.bufferedAmount == 0) { // tell xharness WasmTestMessagesProcessor we are done. // note this sends last few bytes into the same WS console.log("WASM EXIT " + exit_code); } else { setTimeout(stop_when_ws_buffer_empty, 100); } }; stop_when_ws_buffer_empty(); } else if (App && App.INTERNAL) { App.INTERNAL.mono_wasm_exit(exit_code); } } function processArguments(incomingArguments) { console.log("Incoming arguments: " + incomingArguments.join(' ')); let profilers = []; let setenv = {}; let runtime_args = []; let enable_gc = true; let diagnostic_tracing = false; let working_dir = '/'; while (incomingArguments && incomingArguments.length > 0) { const currentArg = incomingArguments[0]; if (currentArg.startsWith("--profile=")) { const arg = currentArg.substring("--profile=".length); profilers.push(arg); } else if (currentArg.startsWith("--setenv=")) { const arg = currentArg.substring("--setenv=".length); const parts = arg.split('='); if (parts.length != 2) set_exit_code(1, "Error: malformed argument: '" + currentArg); setenv[parts[0]] = parts[1]; } else if (currentArg.startsWith("--runtime-arg=")) { const arg = currentArg.substring("--runtime-arg=".length); runtime_args.push(arg); } else if (currentArg == "--disable-on-demand-gc") { enable_gc = false; } else if (currentArg == "--diagnostic_tracing") { diagnostic_tracing = true; } else if (currentArg.startsWith("--working-dir=")) { const arg = currentArg.substring("--working-dir=".length); working_dir = arg; } else { break; } incomingArguments = incomingArguments.slice(1); } // cheap way to let the testing infrastructure know we're running in a browser context (or not) setenv["IsBrowserDomSupported"] = is_browser.toString().toLowerCase(); setenv["IsNodeJS"] = is_node.toString().toLowerCase(); console.log("Application arguments: " + incomingArguments.join(' ')); return { applicationArgs: incomingArguments, profilers, setenv, runtime_args, enable_gc, diagnostic_tracing, working_dir, } } let processedArguments = null; // this can't be function because of `arguments` scope try { if (is_node) { processedArguments = processArguments(process.argv.slice(2)); } else if (is_browser) { // We expect to be run by tests/runtime/run.js which passes in the arguments using http parameters const url = new URL(decodeURI(window.location)); let urlArguments = [] for (let param of url.searchParams) { if (param[0] == "arg") { urlArguments.push(param[1]); } } processedArguments = processArguments(urlArguments); } else if (typeof arguments !== "undefined") { processedArguments = processArguments(Array.from(arguments)); } else if (typeof scriptArgs !== "undefined") { processedArguments = processArguments(Array.from(scriptArgs)); } else if (typeof WScript !== "undefined" && WScript.Arguments) { processedArguments = processArguments(Array.from(WScript.Arguments)); } } catch (e) { console.error(e); } if (is_node) { const modulesToLoad = processedArguments.setenv["NPM_MODULES"]; if (modulesToLoad) { modulesToLoad.split(',').forEach(module => { const { 0:moduleName, 1:globalAlias } = module.split(':'); let message = `Loading npm '${moduleName}'`; let moduleExport = require(moduleName); if (globalAlias) { message += ` and attaching to global as '${globalAlias}'`; globalThis[globalAlias] = moduleExport; } else if(moduleName == "node-fetch") { message += ' and attaching to global'; globalThis.fetch = moduleExport.default; globalThis.Headers = moduleExport.Headers; globalThis.Request = moduleExport.Request; globalThis.Response = moduleExport.Response; } else if(moduleName == "node-abort-controller") { message += ' and attaching to global'; globalThis.AbortController = moduleExport.AbortController; } console.log(message); }); } } // Must be after loading npm modules. processedArguments.setenv["IsWebSocketSupported"] = ("WebSocket" in globalThis).toString().toLowerCase(); async function loadDotnet(file) { let loadScript = undefined; if (typeof WScript !== "undefined") { // Chakra loadScript = function (file) { WScript.LoadScriptFile(file); return globalThis.createDotnetRuntime; }; } else if (is_node) { // NodeJS loadScript = async function (file) { return require(file); }; } else if (is_browser) { // vanila JS in browser loadScript = function (file) { var loaded = new Promise((resolve, reject) => { globalThis.__onDotnetRuntimeLoaded = (createDotnetRuntime) => { // this is callback we have in CJS version of the runtime resolve(createDotnetRuntime); }; import(file).then(({ default: createDotnetRuntime }) => { // this would work with ES6 default export if (createDotnetRuntime) { resolve(createDotnetRuntime); } }, reject); }); return loaded; } } else if (typeof globalThis.load !== 'undefined') { loadScript = async function (file) { globalThis.load(file) return globalThis.createDotnetRuntime; } } else { throw new Error("Unknown environment, can't load config"); } return loadScript(file); }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // -*- mode: js; js-indent-level: 4; -*- // // Run runtime tests under a JS shell or a browser // "use strict"; //glue code to deal with the differences between chrome, ch, d8, jsc and sm. const is_browser = typeof window != "undefined"; const is_node = !is_browser && typeof process === 'object' && typeof process.versions === 'object' && typeof process.versions.node === 'string'; if (is_node && process.versions.node.split(".")[0] < 14) { throw new Error(`NodeJS at '${process.execPath}' has too low version '${process.versions.node}'`); } // if the engine doesn't provide a console if (typeof (console) === "undefined") { globalThis.console = { log: globalThis.print, clear: function () { } }; } const originalConsole = { log: console.log, error: console.error }; function proxyConsoleMethod(prefix, func, asJson) { return function () { try { const args = [...arguments]; let payload = args[0]; if (payload === undefined) payload = 'undefined'; else if (payload === null) payload = 'null'; else if (typeof payload === 'function') payload = payload.toString(); else if (typeof payload !== 'string') { try { payload = JSON.stringify(payload); } catch (e) { payload = payload.toString(); } } if (payload.startsWith("STARTRESULTXML")) { originalConsole.log('Sending RESULTXML') func(payload); } else if (asJson) { func(JSON.stringify({ method: prefix, payload: payload, arguments: args })); } else { func([prefix + payload, ...args.slice(1)]); } } catch (err) { originalConsole.error(`proxyConsole failed: ${err}`) } }; }; const methods = ["debug", "trace", "warn", "info", "error"]; for (let m of methods) { if (typeof (console[m]) !== "function") { console[m] = proxyConsoleMethod(`console.${m}: `, console.log, false); } } let consoleWebSocket; if (is_browser) { const consoleUrl = `${window.location.origin}/console`.replace('http://', 'ws://'); consoleWebSocket = new WebSocket(consoleUrl); consoleWebSocket.onopen = function (event) { originalConsole.log("browser: Console websocket connected."); }; consoleWebSocket.onerror = function (event) { originalConsole.error(`websocket error: ${event}`); }; consoleWebSocket.onclose = function (event) { originalConsole.error(`websocket closed: ${event}`); }; const send = (msg) => { if (consoleWebSocket.readyState === WebSocket.OPEN) { consoleWebSocket.send(msg); } else { originalConsole.log(msg); } } // redirect output early, so that when emscripten starts it's already redirected for (let m of ["log", ...methods]) console[m] = proxyConsoleMethod(`console.${m}`, send, true); } function stringify_as_error_with_stack(err) { if (!err) return ""; if (App && App.INTERNAL) return App.INTERNAL.mono_wasm_stringify_as_error_with_stack(err); if (err.stack) return err.stack; if (typeof err == "string") return err; return JSON.stringify(err); } if (typeof globalThis.crypto === 'undefined') { // **NOTE** this is a simple insecure polyfill for testing purposes only // /dev/random doesn't work on js shells, so define our own // See library_fs.js:createDefaultDevices () globalThis.crypto = { getRandomValues: function (buffer) { for (let i = 0; i < buffer.length; i++) buffer[i] = (Math.random() * 256) | 0; } } } if (typeof globalThis.performance === 'undefined') { if (is_node) { const { performance } = require("perf_hooks"); globalThis.performance = performance; } else { // performance.now() is used by emscripten and doesn't work in JSC globalThis.performance = { now: function () { return Date.now(); } } } } loadDotnet("./dotnet.js").then((createDotnetRuntime) => { return createDotnetRuntime(({ MONO, INTERNAL, BINDING, Module }) => ({ disableDotnet6Compatibility: true, config: null, configSrc: "./mono-config.json", onConfigLoaded: (config) => { if (!Module.config) { const err = new Error("Could not find ./mono-config.json. Cancelling run"); set_exit_code(1); throw err; } // Have to set env vars here to enable setting MONO_LOG_LEVEL etc. for (let variable in processedArguments.setenv) { config.environment_variables[variable] = processedArguments.setenv[variable]; } config.diagnostic_tracing = !!processedArguments.diagnostic_tracing; }, preRun: () => { if (!processedArguments.enable_gc) { INTERNAL.mono_wasm_enable_on_demand_gc(0); } }, onDotnetReady: () => { let wds = Module.FS.stat(processedArguments.working_dir); if (wds === undefined || !Module.FS.isDir(wds.mode)) { set_exit_code(1, `Could not find working directory ${processedArguments.working_dir}`); return; } Module.FS.chdir(processedArguments.working_dir); App.init({ MONO, INTERNAL, BINDING, Module }); }, onAbort: (error) => { set_exit_code(1, stringify_as_error_with_stack(new Error())); }, })) }).catch(function (err) { set_exit_code(1, "failed to load the dotnet.js file.\n" + stringify_as_error_with_stack(err)); }); const App = { init: async function ({ MONO, INTERNAL, BINDING, Module }) { console.info("Initializing....."); Object.assign(App, { MONO, INTERNAL, BINDING, Module }); for (let i = 0; i < processedArguments.profilers.length; ++i) { const init = Module.cwrap('mono_wasm_load_profiler_' + processedArguments.profilers[i], 'void', ['string']); init(""); } if (processedArguments.applicationArgs.length == 0) { set_exit_code(1, "Missing required --run argument"); return; } if (processedArguments.applicationArgs[0] == "--regression") { const exec_regression = Module.cwrap('mono_wasm_exec_regression', 'number', ['number', 'string']); let res = 0; try { res = exec_regression(10, processedArguments.applicationArgs[1]); console.log("REGRESSION RESULT: " + res); } catch (e) { console.error("ABORT: " + e); console.error(e.stack); res = 1; } if (res) set_exit_code(1, "REGRESSION TEST FAILED"); return; } if (processedArguments.runtime_args.length > 0) INTERNAL.mono_wasm_set_runtime_options(processedArguments.runtime_args); if (processedArguments.applicationArgs[0] == "--run") { // Run an exe if (processedArguments.applicationArgs.length == 1) { set_exit_code(1, "Error: Missing main executable argument."); return; } try { const main_assembly_name = processedArguments.applicationArgs[1]; const app_args = processedArguments.applicationArgs.slice(2); const result = await MONO.mono_run_main(main_assembly_name, app_args); set_exit_code(result); } catch (error) { if (error.name != "ExitStatus") { set_exit_code(1, error); } } } else { set_exit_code(1, "Unhandled argument: " + processedArguments.applicationArgs[0]); } }, /** Runs a particular test * @type {(method_name: string, args: any[]=, signature: any=) => return number} */ call_test_method: function (method_name, args, signature) { // note: arguments here is the array of arguments passsed to this function if ((arguments.length > 2) && (typeof (signature) !== "string")) throw new Error("Invalid number of arguments for call_test_method"); const fqn = "[System.Private.Runtime.InteropServices.JavaScript.Tests]System.Runtime.InteropServices.JavaScript.Tests.HelperMarshal:" + method_name; try { return App.INTERNAL.call_static_method(fqn, args || [], signature); } catch (exc) { console.error("exception thrown in", fqn); throw exc; } } }; globalThis.App = App; // Necessary as System.Runtime.InteropServices.JavaScript.Tests.MarshalTests (among others) call the App.call_test_method directly function set_exit_code(exit_code, reason) { if (reason) { if (reason instanceof Error) console.error(stringify_as_error_with_stack(reason)); else if (typeof reason == "string") console.error(reason); else console.error(JSON.stringify(reason)); } if (is_browser) { if (App.Module) { // Notify the selenium script App.Module.exit_code = exit_code; } //Tell xharness WasmBrowserTestRunner what was the exit code const tests_done_elem = document.createElement("label"); tests_done_elem.id = "tests_done"; tests_done_elem.innerHTML = exit_code.toString(); document.body.appendChild(tests_done_elem); const stop_when_ws_buffer_empty = () => { if (consoleWebSocket.bufferedAmount == 0) { // tell xharness WasmTestMessagesProcessor we are done. // note this sends last few bytes into the same WS console.log("WASM EXIT " + exit_code); } else { setTimeout(stop_when_ws_buffer_empty, 100); } }; stop_when_ws_buffer_empty(); } else if (App && App.INTERNAL) { App.INTERNAL.mono_wasm_exit(exit_code); } } function processArguments(incomingArguments) { console.log("Incoming arguments: " + incomingArguments.join(' ')); let profilers = []; let setenv = {}; let runtime_args = []; let enable_gc = true; let diagnostic_tracing = false; let working_dir = '/'; while (incomingArguments && incomingArguments.length > 0) { const currentArg = incomingArguments[0]; if (currentArg.startsWith("--profile=")) { const arg = currentArg.substring("--profile=".length); profilers.push(arg); } else if (currentArg.startsWith("--setenv=")) { const arg = currentArg.substring("--setenv=".length); const parts = arg.split('='); if (parts.length != 2) set_exit_code(1, "Error: malformed argument: '" + currentArg); setenv[parts[0]] = parts[1]; } else if (currentArg.startsWith("--runtime-arg=")) { const arg = currentArg.substring("--runtime-arg=".length); runtime_args.push(arg); } else if (currentArg == "--disable-on-demand-gc") { enable_gc = false; } else if (currentArg == "--diagnostic_tracing") { diagnostic_tracing = true; } else if (currentArg.startsWith("--working-dir=")) { const arg = currentArg.substring("--working-dir=".length); working_dir = arg; } else { break; } incomingArguments = incomingArguments.slice(1); } // cheap way to let the testing infrastructure know we're running in a browser context (or not) setenv["IsBrowserDomSupported"] = is_browser.toString().toLowerCase(); setenv["IsNodeJS"] = is_node.toString().toLowerCase(); console.log("Application arguments: " + incomingArguments.join(' ')); return { applicationArgs: incomingArguments, profilers, setenv, runtime_args, enable_gc, diagnostic_tracing, working_dir, } } let processedArguments = null; // this can't be function because of `arguments` scope try { if (is_node) { processedArguments = processArguments(process.argv.slice(2)); } else if (is_browser) { // We expect to be run by tests/runtime/run.js which passes in the arguments using http parameters const url = new URL(decodeURI(window.location)); let urlArguments = [] for (let param of url.searchParams) { if (param[0] == "arg") { urlArguments.push(param[1]); } } processedArguments = processArguments(urlArguments); } else if (typeof arguments !== "undefined") { processedArguments = processArguments(Array.from(arguments)); } else if (typeof scriptArgs !== "undefined") { processedArguments = processArguments(Array.from(scriptArgs)); } else if (typeof WScript !== "undefined" && WScript.Arguments) { processedArguments = processArguments(Array.from(WScript.Arguments)); } } catch (e) { console.error(e); } if (is_node) { const modulesToLoad = processedArguments.setenv["NPM_MODULES"]; if (modulesToLoad) { modulesToLoad.split(',').forEach(module => { const { 0:moduleName, 1:globalAlias } = module.split(':'); let message = `Loading npm '${moduleName}'`; let moduleExport = require(moduleName); if (globalAlias) { message += ` and attaching to global as '${globalAlias}'`; globalThis[globalAlias] = moduleExport; } else if(moduleName == "node-fetch") { message += ' and attaching to global'; globalThis.fetch = moduleExport.default; globalThis.Headers = moduleExport.Headers; globalThis.Request = moduleExport.Request; globalThis.Response = moduleExport.Response; } else if(moduleName == "node-abort-controller") { message += ' and attaching to global'; globalThis.AbortController = moduleExport.AbortController; } console.log(message); }); } } // Must be after loading npm modules. processedArguments.setenv["IsWebSocketSupported"] = ("WebSocket" in globalThis).toString().toLowerCase(); async function loadDotnet(file) { let loadScript = undefined; if (typeof WScript !== "undefined") { // Chakra loadScript = function (file) { WScript.LoadScriptFile(file); return globalThis.createDotnetRuntime; }; } else if (is_node) { // NodeJS loadScript = async function (file) { return require(file); }; } else if (is_browser) { // vanila JS in browser loadScript = function (file) { var loaded = new Promise((resolve, reject) => { globalThis.__onDotnetRuntimeLoaded = (createDotnetRuntime) => { // this is callback we have in CJS version of the runtime resolve(createDotnetRuntime); }; import(file).then(({ default: createDotnetRuntime }) => { // this would work with ES6 default export if (createDotnetRuntime) { resolve(createDotnetRuntime); } }, reject); }); return loaded; } } else if (typeof globalThis.load !== 'undefined') { loadScript = async function (file) { globalThis.load(file) return globalThis.createDotnetRuntime; } } else { throw new Error("Unknown environment, can't load config"); } return loadScript(file); }
1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/mono/wasm/wasm.proj
<Project Sdk="Microsoft.Build.NoTargets"> <UsingTask TaskName="Microsoft.WebAssembly.Build.Tasks.RunWithEmSdkEnv" AssemblyFile="$(WasmAppBuilderTasksAssemblyPath)" /> <PropertyGroup> <!-- FIXME: clean up the duplication with libraries Directory.Build.props --> <PackageRID>browser-wasm</PackageRID> <NativeBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'native', '$(NetCoreAppCurrent)-$(TargetOS)-$(Configuration)-$(TargetArchitecture)'))</NativeBinDir> <ICULibDir>$([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm', 'native', 'lib'))</ICULibDir> <WasmEnableES6 Condition="'$(WasmEnableES6)' == ''">false</WasmEnableES6> <FilterSystemTimeZones Condition="'$(FilterSystemTimeZones)' == ''">false</FilterSystemTimeZones> <EmccCmd>emcc</EmccCmd> <WasmObjDir>$(ArtifactsObjDir)wasm</WasmObjDir> <_EmccDefaultsRspPath>$(NativeBinDir)src\emcc-default.rsp</_EmccDefaultsRspPath> <_EmccCompileRspPath>$(NativeBinDir)src\emcc-compile.rsp</_EmccCompileRspPath> <_EmccLinkRspPath>$(NativeBinDir)src\emcc-link.rsp</_EmccLinkRspPath> <WasmNativeStrip Condition="'$(ContinuousIntegrationBuild)' == 'true'">false</WasmNativeStrip> </PropertyGroup> <Target Name="CheckEnv"> <Error Condition="'$(TargetArchitecture)' != 'wasm'" Text="Expected TargetArchitecture==wasm, got '$(TargetArchitecture)'"/> <Error Condition="'$(TargetOS)' != 'Browser'" Text="Expected TargetOS==Browser, got '$(TargetOS)'"/> <Error Condition="'$(EMSDK_PATH)' == ''" Text="The EMSDK_PATH environment variable should be set pointing to the emscripten SDK root dir."/> </Target> <ItemGroup> <PackageReference Include="Microsoft.NETCore.Runtime.ICU.Transport" PrivateAssets="all" Version="$(MicrosoftNETCoreRuntimeICUTransportVersion)" GeneratePathProperty="true" /> <PackageReference Include="System.Runtime.TimeZoneData" PrivateAssets="all" Version="$(SystemRuntimeTimeZoneDataVersion)" GeneratePathProperty="true" /> </ItemGroup> <UsingTask TaskName="PInvokeTableGenerator" AssemblyFile="$(WasmAppBuilderTasksAssemblyPath)"/> <Target Name="BuildPInvokeTable" DependsOnTargets="CheckEnv;ResolveLibrariesFromLocalBuild"> <PropertyGroup> <WasmPInvokeTablePath>$(ArtifactsObjDir)wasm\pinvoke-table.h</WasmPInvokeTablePath> </PropertyGroup> <ItemGroup> <WasmPInvokeModule Include="libSystem.Native" /> <WasmPInvokeModule Include="libSystem.IO.Compression.Native" /> <WasmPInvokeModule Include="libSystem.Globalization.Native" /> <WasmPInvokeAssembly Include="@(LibrariesRuntimeFiles)" Condition="'%(Extension)' == '.dll' and '%(IsNative)' != 'true'" /> </ItemGroup> <!-- Retrieve CoreLib's targetpath via GetTargetPath as it isn't binplaced yet. --> <MSBuild Projects="$(CoreLibProject)" Targets="GetTargetPath"> <Output TaskParameter="TargetOutputs" ItemName="WasmPInvokeAssembly" /> </MSBuild> <MakeDir Directories="$(ArtifactsObjDir)wasm" /> <PInvokeTableGenerator Modules="@(WasmPInvokeModule)" Assemblies="@(WasmPInvokeAssembly)" OutputPath="$(WasmPInvokeTablePath)" /> </Target> <UsingTask TaskName="GenerateWasmBundle" AssemblyFile="$(WasmBuildTasksAssemblyPath)"/> <Target Name="BundleTimeZones"> <PropertyGroup> <TimeZonesDataPath>$(NativeBinDir)dotnet.timezones.blat</TimeZonesDataPath> </PropertyGroup> <GenerateWasmBundle InputDirectory="$([MSBuild]::NormalizePath('$(PkgSystem_Runtime_TimeZoneData)', 'contentFiles', 'any', 'any', 'data'))" OutputFileName="$(TimeZonesDataPath)" /> </Target> <Target Name="GenerateEmccPropsAndRspFiles"> <ItemGroup> <_EmccLinkFlags Include="-s EXPORT_ES6=1" Condition="'$(WasmEnableES6)' == 'true'" /> <_EmccLinkFlags Include="-s ALLOW_MEMORY_GROWTH=1" /> <_EmccLinkFlags Include="-s NO_EXIT_RUNTIME=1" /> <_EmccLinkFlags Include="-s FORCE_FILESYSTEM=1" /> <_EmccLinkFlags Include="-s EXPORTED_RUNTIME_METHODS=&quot;['FS','print','ccall','cwrap','setValue','getValue','UTF8ToString','UTF8ArrayToString','FS_createPath','FS_createDataFile','removeRunDependency','addRunDependency']&quot;" /> <!-- _htons,_ntohs,__get_daylight,__get_timezone,__get_tzname are exported temporarily, until the issue is fixed in emscripten, https://github.com/dotnet/runtime/issues/64724 --> <_EmccLinkFlags Include="-s EXPORTED_FUNCTIONS=_free,_malloc,_htons,_ntohs,__get_daylight,__get_timezone,__get_tzname,_memalign" /> <_EmccLinkFlags Include="--source-map-base http://example.com" /> <_EmccLinkFlags Include="-s STRICT_JS=1" /> <_EmccLinkFlags Include="-s EXPORT_NAME=&quot;'createDotnetRuntime'&quot;" /> <_EmccLinkFlags Include="-s MODULARIZE=1"/> <_EmccLinkFlags Include="-Wl,--allow-undefined"/> <_EmccLinkFlags Include="-s ENVIRONMENT=&quot;web,webview,worker,node,shell&quot;" /> </ItemGroup> <ItemGroup Condition="'$(OS)' != 'Windows_NT'"> <_EmccLinkFlags Include="--profiling-funcs" /> <_EmccFlags Include="@(_EmccCommonFlags)" /> </ItemGroup> <ItemGroup Condition="'$(OS)' == 'Windows_NT'"> <_EmccFlags Include="@(_EmccCommonFlags)" /> </ItemGroup> <WriteLinesToFile File="$(_EmccDefaultsRspPath)" Lines="@(_EmccFlags)" WriteOnlyWhenDifferent="true" Overwrite="true" /> <WriteLinesToFile File="$(_EmccCompileRspPath)" Lines="@(_EmccCompileFlags)" WriteOnlyWhenDifferent="true" Overwrite="true" /> <WriteLinesToFile File="$(_EmccLinkRspPath)" Lines="@(_EmccLinkFlags)" WriteOnlyWhenDifferent="true" Overwrite="true" /> <!-- Generate emcc-props.json --> <RunWithEmSdkEnv Command="$(EmccCmd) --version" ConsoleToMsBuild="true" EmSdkPath="$(EMSDK_PATH)" IgnoreStandardErrorWarningFormat="true"> <Output TaskParameter="ConsoleOutput" ItemName="_VersionLines" /> </RunWithEmSdkEnv> <!-- we want to get the first line from the output, which has the version. Rest of the lines are the license --> <ItemGroup> <_ReversedVersionLines Include="@(_VersionLines->Reverse())" /> </ItemGroup> <PropertyGroup> <_EmccVersionRaw>%(_ReversedVersionLines.Identity)</_EmccVersionRaw> <_EmccVersionRegexPattern>^ *emcc \([^\)]+\) *([0-9\.]+).*\(([^\)]+)\)$</_EmccVersionRegexPattern> <_EmccVersion>$([System.Text.RegularExpressions.Regex]::Match($(_EmccVersionRaw), $(_EmccVersionRegexPattern)).Groups[1].Value)</_EmccVersion> <_EmccVersionHash>$([System.Text.RegularExpressions.Regex]::Match($(_EmccVersionRaw), $(_EmccVersionRegexPattern)).Groups[2].Value)</_EmccVersionHash> <_EmccPropsJson> <![CDATA[ { "items": { "EmccProperties": [ { "identity": "RuntimeEmccVersion", "value": "$(_EmccVersion)" }, { "identity": "RuntimeEmccVersionRaw", "value": "$(_EmccVersionRaw)" }, { "identity": "RuntimeEmccVersionHash", "value": "$(_EmccVersionHash)" } ] } } ]]> </_EmccPropsJson> </PropertyGroup> <Error Text="Failed to parse emcc version, and hash from the full version string: '$(_EmccVersionRaw)'" Condition="'$(_EmccVersion)' == '' or '$(_EmccVersionHash)' == ''" /> <WriteLinesToFile File="$(NativeBinDir)src\emcc-props.json" Lines="$(_EmccPropsJson)" Overwrite="true" WriteOnlyWhenDifferent="true" /> </Target> <!-- This is a documented target that is invoked by developers in their innerloop work. --> <Target Name="BuildWasmRuntimes" AfterTargets="Build" DependsOnTargets="GenerateEmccPropsAndRspFiles;BuildPInvokeTable;BundleTimeZones;InstallNpmPackages;BuildWithRollup"> <ItemGroup> <ICULibNativeFiles Include="$(ICULibDir)/libicuuc.a; $(ICULibDir)/libicui18n.a" /> <ICULibFiles Include="$(ICULibDir)/*.dat" /> </ItemGroup> <PropertyGroup> <PInvokeTableFile>$(ArtifactsObjDir)wasm/pinvoke-table.h</PInvokeTableFile> <CMakeConfigurationEmccFlags Condition="'$(Configuration)' == 'Debug'">-g -Os -s -DDEBUG=1 -DENABLE_AOT_PROFILER=1</CMakeConfigurationEmccFlags> <CMakeConfigurationEmccFlags Condition="'$(Configuration)' == 'Release'">-Oz</CMakeConfigurationEmccFlags> <CMakeConfigurationLinkFlags Condition="'$(Configuration)' == 'Debug'" >$(CMakeConfigurationEmccFlags)</CMakeConfigurationLinkFlags> <CMakeConfigurationLinkFlags Condition="'$(Configuration)' == 'Release'">-O2</CMakeConfigurationLinkFlags> <CMakeConfigurationLinkFlags >$(CMakeConfigurationLinkFlags) --emit-symbol-map</CMakeConfigurationLinkFlags> <CMakeConfigurationEmsdkPath Condition="'$(Configuration)' == 'Release'"> -DEMSDK_PATH=&quot;$(EMSDK_PATH.TrimEnd('\/'))&quot;</CMakeConfigurationEmsdkPath> <CMakeBuildRuntimeConfigureCmd>emcmake cmake $(MSBuildThisFileDirectory)runtime</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DCMAKE_BUILD_TYPE=$(Configuration)</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_EMCC_FLAGS=&quot;$(CMakeConfigurationEmccFlags)&quot;</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_LINK_FLAGS=&quot;$(CMakeConfigurationLinkFlags)&quot;</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DMONO_INCLUDES=&quot;$(MonoArtifactsPath)include/mono-2.0&quot;</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DMONO_OBJ_INCLUDES=&quot;$(MonoObjDir.TrimEnd('\/'))&quot;</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DICU_LIB_DIR=&quot;$(ICULibDir.TrimEnd('\/'))&quot;</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DMONO_ARTIFACTS_DIR=&quot;$(MonoArtifactsPath.TrimEnd('\/'))&quot;</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DNATIVE_BIN_DIR=&quot;$(NativeBinDir.TrimEnd('\/'))&quot;</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) $(CMakeConfigurationEmsdkPath)</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd Condition="'$(OS)' == 'Windows_NT'">call &quot;$(RepositoryEngineeringDir)native\init-vs-env.cmd&quot; &amp;&amp; call &quot;$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.bat'))&quot; &amp;&amp; $(CMakeBuildRuntimeConfigureCmd)</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd Condition="'$(OS)' != 'Windows_NT'">bash -c 'source $(EMSDK_PATH)/emsdk_env.sh 2>&amp;1 &amp;&amp; $(CMakeBuildRuntimeConfigureCmd)'</CMakeBuildRuntimeConfigureCmd> <CMakeOptions Condition="'$(MonoVerboseBuild)' != ''">-v</CMakeOptions> <CMakeBuildRuntimeCmd>cmake --build . --config $(Configuration) $(CmakeOptions)</CMakeBuildRuntimeCmd> <CMakeBuildRuntimeCmd Condition="'$(OS)' == 'Windows_NT'">call &quot;$(RepositoryEngineeringDir)native\init-vs-env.cmd&quot; &amp;&amp; call &quot;$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.bat'))&quot; &amp;&amp; $(CMakeBuildRuntimeCmd)</CMakeBuildRuntimeCmd> <CMakeBuildRuntimeCmd Condition="'$(OS)' != 'Windows_NT'">bash -c 'source $(EMSDK_PATH)/emsdk_env.sh 2>&amp;1 &amp;&amp; $(CMakeBuildRuntimeCmd)'</CMakeBuildRuntimeCmd> </PropertyGroup> <Copy SourceFiles="$(PInvokeTableFile)" DestinationFolder="$(MonoObjDir)" SkipUnchangedFiles="true" /> <Copy SourceFiles="runtime/driver.c; runtime/pinvoke.c; runtime/corebindings.c; $(SharedNativeRoot)libs\System.Native\pal_random.lib.js;" DestinationFolder="$(NativeBinDir)src" SkipUnchangedFiles="true" /> <Copy SourceFiles="runtime/cjs/dotnet.cjs.pre.js; runtime/cjs/dotnet.cjs.lib.js; runtime/cjs/dotnet.cjs.post.js; runtime/cjs/dotnet.cjs.extpost.js;" DestinationFolder="$(NativeBinDir)src/cjs" SkipUnchangedFiles="true" /> <Copy SourceFiles="runtime/es6/dotnet.es6.pre.js; runtime/es6/dotnet.es6.lib.js; runtime/es6/dotnet.es6.post.js;" DestinationFolder="$(NativeBinDir)src/es6" SkipUnchangedFiles="true" /> <Copy SourceFiles="runtime\pinvoke.h" DestinationFolder="$(NativeBinDir)include\wasm" SkipUnchangedFiles="true" /> <Copy SourceFiles="@(ICULibFiles); @(ICULibNativeFiles);" DestinationFolder="$(NativeBinDir)" SkipUnchangedFiles="true" /> <Exec Command="$(CMakeBuildRuntimeConfigureCmd)" WorkingDirectory="$(NativeBinDir)" /> <Exec Command="$(CMakeBuildRuntimeCmd)" WorkingDirectory="$(NativeBinDir)" /> <ItemGroup> <IcuDataFiles Include="$(NativeBinDir)*.dat" /> <WasmSrcFiles Include="$(NativeBinDir)src\*.c; $(NativeBinDir)src\*.js; $(_EmccDefaultsRspPath); $(_EmccCompileRspPath); $(_EmccLinkRspPath); $(NativeBinDir)src\emcc-props.json" /> <WasmSrcFilesCjs Include="$(NativeBinDir)src\cjs\*.js;" /> <WasmSrcFilesEs6 Include="$(NativeBinDir)src\es6\*.js;" /> <WasmHeaderFiles Include="$(NativeBinDir)include\wasm\*.h" /> </ItemGroup> <Copy SourceFiles="$(NativeBinDir)dotnet.js; $(NativeBinDir)dotnet.d.ts; $(NativeBinDir)package.json; $(NativeBinDir)dotnet.wasm; $(NativeBinDir)dotnet.timezones.blat" DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)" SkipUnchangedFiles="true" /> <Copy SourceFiles="$(NativeBinDir)dotnet.js.symbols" DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)" SkipUnchangedFiles="true" /> <Copy SourceFiles="@(IcuDataFiles);@(ICULibNativeFiles)" DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)" SkipUnchangedFiles="true" /> <Copy SourceFiles="@(WasmSrcFiles)" DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)src" SkipUnchangedFiles="true" /> <Copy SourceFiles="@(WasmSrcFilesCjs)" DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)src\cjs" SkipUnchangedFiles="true" /> <Copy SourceFiles="@(WasmSrcFilesEs6)" DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)src\es6" SkipUnchangedFiles="true" /> <Copy SourceFiles="@(WasmHeaderFiles)" DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)include\wasm" SkipUnchangedFiles="true" /> </Target> <Target Name="InstallNpmPackages" Inputs="$(MonoProjectRoot)wasm/runtime/package.json" Outputs="$(MonoProjectRoot)wasm/runtime/node_modules/.npm-stamp" > <!-- install typescript and rollup --> <RunWithEmSdkEnv Condition="'$(ContinuousIntegrationBuild)' == 'true'" Command="npm ci" EmSdkPath="$(EMSDK_PATH)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoProjectRoot)wasm/runtime/"/> <RunWithEmSdkEnv Condition="'$(ContinuousIntegrationBuild)' == 'true'" Command="npm audit" EmSdkPath="$(EMSDK_PATH)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoProjectRoot)wasm/runtime/"/> <!-- npm install is faster on dev machine as it doesn't wipe node_modules folder --> <RunWithEmSdkEnv Condition="'$(ContinuousIntegrationBuild)' != 'true'" Command="npm install" EmSdkPath="$(EMSDK_PATH)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoProjectRoot)wasm/runtime/"/> <Touch Files="$(MonoProjectRoot)wasm/runtime/node_modules/.npm-stamp" AlwaysCreate="true" /> </Target> <ItemGroup> <_RollupInputs Include="$(MonoProjectRoot)wasm/runtime/*.ts"/> <_RollupInputs Include="$(MonoProjectRoot)wasm/runtime/types/*.ts"/> <_RollupInputs Include="$(MonoProjectRoot)wasm/runtimetypes/*.d.ts"/> <_RollupInputs Include="$(MonoProjectRoot)wasm/runtime/*.json"/> <_RollupInputs Include="$(MonoProjectRoot)wasm/runtime/*.js"/> </ItemGroup> <Target Name="BuildWithRollup" Inputs="@(_RollupInputs)" Outputs="$(NativeBinDir).rollup-stamp" > <!-- code style check --> <RunWithEmSdkEnv Command="npm run lint" StandardOutputImportance="High" EmSdkPath="$(EMSDK_PATH)" WorkingDirectory="$(MonoProjectRoot)wasm/runtime/"/> <!-- compile typescript --> <RunWithEmSdkEnv Command="npm run rollup -- --environment Configuration:$(Configuration),NativeBinDir:$(NativeBinDir),ProductVersion:$(ProductVersion)" EmSdkPath="$(EMSDK_PATH)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoProjectRoot)wasm/runtime/"/> <Copy SourceFiles="runtime/package.json;" DestinationFolder="$(NativeBinDir)" SkipUnchangedFiles="true" /> <!-- set version --> <RunWithEmSdkEnv Command="npm version $(PackageVersion)" EmSdkPath="$(EMSDK_PATH)" WorkingDirectory="$(NativeBinDir)"/> <Touch Files="$(NativeBinDir).rollup-stamp" AlwaysCreate="true" /> </Target> </Project>
<Project Sdk="Microsoft.Build.NoTargets"> <UsingTask TaskName="Microsoft.WebAssembly.Build.Tasks.RunWithEmSdkEnv" AssemblyFile="$(WasmAppBuilderTasksAssemblyPath)" /> <PropertyGroup> <!-- FIXME: clean up the duplication with libraries Directory.Build.props --> <PackageRID>browser-wasm</PackageRID> <NativeBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'native', '$(NetCoreAppCurrent)-$(TargetOS)-$(Configuration)-$(TargetArchitecture)'))</NativeBinDir> <ICULibDir>$([MSBuild]::NormalizeDirectory('$(PkgMicrosoft_NETCore_Runtime_ICU_Transport)', 'runtimes', 'browser-wasm', 'native', 'lib'))</ICULibDir> <WasmEnableES6 Condition="'$(WasmEnableES6)' == ''">false</WasmEnableES6> <FilterSystemTimeZones Condition="'$(FilterSystemTimeZones)' == ''">false</FilterSystemTimeZones> <EmccCmd>emcc</EmccCmd> <WasmObjDir>$(ArtifactsObjDir)wasm</WasmObjDir> <_EmccDefaultsRspPath>$(NativeBinDir)src\emcc-default.rsp</_EmccDefaultsRspPath> <_EmccCompileRspPath>$(NativeBinDir)src\emcc-compile.rsp</_EmccCompileRspPath> <_EmccLinkRspPath>$(NativeBinDir)src\emcc-link.rsp</_EmccLinkRspPath> <WasmNativeStrip Condition="'$(ContinuousIntegrationBuild)' == 'true'">false</WasmNativeStrip> </PropertyGroup> <Target Name="CheckEnv"> <Error Condition="'$(TargetArchitecture)' != 'wasm'" Text="Expected TargetArchitecture==wasm, got '$(TargetArchitecture)'"/> <Error Condition="'$(TargetOS)' != 'Browser'" Text="Expected TargetOS==Browser, got '$(TargetOS)'"/> <Error Condition="'$(EMSDK_PATH)' == ''" Text="The EMSDK_PATH environment variable should be set pointing to the emscripten SDK root dir."/> </Target> <ItemGroup> <PackageReference Include="Microsoft.NETCore.Runtime.ICU.Transport" PrivateAssets="all" Version="$(MicrosoftNETCoreRuntimeICUTransportVersion)" GeneratePathProperty="true" /> <PackageReference Include="System.Runtime.TimeZoneData" PrivateAssets="all" Version="$(SystemRuntimeTimeZoneDataVersion)" GeneratePathProperty="true" /> </ItemGroup> <UsingTask TaskName="PInvokeTableGenerator" AssemblyFile="$(WasmAppBuilderTasksAssemblyPath)"/> <Target Name="BuildPInvokeTable" DependsOnTargets="CheckEnv;ResolveLibrariesFromLocalBuild"> <PropertyGroup> <WasmPInvokeTablePath>$(ArtifactsObjDir)wasm\pinvoke-table.h</WasmPInvokeTablePath> </PropertyGroup> <ItemGroup> <WasmPInvokeModule Include="libSystem.Native" /> <WasmPInvokeModule Include="libSystem.IO.Compression.Native" /> <WasmPInvokeModule Include="libSystem.Globalization.Native" /> <WasmPInvokeAssembly Include="@(LibrariesRuntimeFiles)" Condition="'%(Extension)' == '.dll' and '%(IsNative)' != 'true'" /> </ItemGroup> <!-- Retrieve CoreLib's targetpath via GetTargetPath as it isn't binplaced yet. --> <MSBuild Projects="$(CoreLibProject)" Targets="GetTargetPath"> <Output TaskParameter="TargetOutputs" ItemName="WasmPInvokeAssembly" /> </MSBuild> <MakeDir Directories="$(ArtifactsObjDir)wasm" /> <PInvokeTableGenerator Modules="@(WasmPInvokeModule)" Assemblies="@(WasmPInvokeAssembly)" OutputPath="$(WasmPInvokeTablePath)" /> </Target> <UsingTask TaskName="GenerateWasmBundle" AssemblyFile="$(WasmBuildTasksAssemblyPath)"/> <Target Name="BundleTimeZones"> <PropertyGroup> <TimeZonesDataPath>$(NativeBinDir)dotnet.timezones.blat</TimeZonesDataPath> </PropertyGroup> <GenerateWasmBundle InputDirectory="$([MSBuild]::NormalizePath('$(PkgSystem_Runtime_TimeZoneData)', 'contentFiles', 'any', 'any', 'data'))" OutputFileName="$(TimeZonesDataPath)" /> </Target> <Target Name="GenerateEmccPropsAndRspFiles"> <ItemGroup> <_EmccLinkFlags Include="-s EXPORT_ES6=1" Condition="'$(WasmEnableES6)' == 'true'" /> <_EmccLinkFlags Include="-s ALLOW_MEMORY_GROWTH=1" /> <_EmccLinkFlags Include="-s NO_EXIT_RUNTIME=1" /> <_EmccLinkFlags Include="-s FORCE_FILESYSTEM=1" /> <_EmccLinkFlags Include="-s EXPORTED_RUNTIME_METHODS=&quot;['FS','print','ccall','cwrap','setValue','getValue','UTF8ToString','UTF8ArrayToString','FS_createPath','FS_createDataFile','removeRunDependency','addRunDependency', 'FS_readFile']&quot;" /> <!-- _htons,_ntohs,__get_daylight,__get_timezone,__get_tzname are exported temporarily, until the issue is fixed in emscripten, https://github.com/dotnet/runtime/issues/64724 --> <_EmccLinkFlags Include="-s EXPORTED_FUNCTIONS=_free,_malloc,_htons,_ntohs,__get_daylight,__get_timezone,__get_tzname,_memalign" /> <_EmccLinkFlags Include="--source-map-base http://example.com" /> <_EmccLinkFlags Include="-s STRICT_JS=1" /> <_EmccLinkFlags Include="-s EXPORT_NAME=&quot;'createDotnetRuntime'&quot;" /> <_EmccLinkFlags Include="-s MODULARIZE=1"/> <_EmccLinkFlags Include="-Wl,--allow-undefined"/> <_EmccLinkFlags Include="-s ENVIRONMENT=&quot;web,webview,worker,node,shell&quot;" /> </ItemGroup> <ItemGroup Condition="'$(OS)' != 'Windows_NT'"> <_EmccLinkFlags Include="--profiling-funcs" /> <_EmccFlags Include="@(_EmccCommonFlags)" /> </ItemGroup> <ItemGroup Condition="'$(OS)' == 'Windows_NT'"> <_EmccFlags Include="@(_EmccCommonFlags)" /> </ItemGroup> <WriteLinesToFile File="$(_EmccDefaultsRspPath)" Lines="@(_EmccFlags)" WriteOnlyWhenDifferent="true" Overwrite="true" /> <WriteLinesToFile File="$(_EmccCompileRspPath)" Lines="@(_EmccCompileFlags)" WriteOnlyWhenDifferent="true" Overwrite="true" /> <WriteLinesToFile File="$(_EmccLinkRspPath)" Lines="@(_EmccLinkFlags)" WriteOnlyWhenDifferent="true" Overwrite="true" /> <!-- Generate emcc-props.json --> <RunWithEmSdkEnv Command="$(EmccCmd) --version" ConsoleToMsBuild="true" EmSdkPath="$(EMSDK_PATH)" IgnoreStandardErrorWarningFormat="true"> <Output TaskParameter="ConsoleOutput" ItemName="_VersionLines" /> </RunWithEmSdkEnv> <!-- we want to get the first line from the output, which has the version. Rest of the lines are the license --> <ItemGroup> <_ReversedVersionLines Include="@(_VersionLines->Reverse())" /> </ItemGroup> <PropertyGroup> <_EmccVersionRaw>%(_ReversedVersionLines.Identity)</_EmccVersionRaw> <_EmccVersionRegexPattern>^ *emcc \([^\)]+\) *([0-9\.]+).*\(([^\)]+)\)$</_EmccVersionRegexPattern> <_EmccVersion>$([System.Text.RegularExpressions.Regex]::Match($(_EmccVersionRaw), $(_EmccVersionRegexPattern)).Groups[1].Value)</_EmccVersion> <_EmccVersionHash>$([System.Text.RegularExpressions.Regex]::Match($(_EmccVersionRaw), $(_EmccVersionRegexPattern)).Groups[2].Value)</_EmccVersionHash> <_EmccPropsJson> <![CDATA[ { "items": { "EmccProperties": [ { "identity": "RuntimeEmccVersion", "value": "$(_EmccVersion)" }, { "identity": "RuntimeEmccVersionRaw", "value": "$(_EmccVersionRaw)" }, { "identity": "RuntimeEmccVersionHash", "value": "$(_EmccVersionHash)" } ] } } ]]> </_EmccPropsJson> </PropertyGroup> <Error Text="Failed to parse emcc version, and hash from the full version string: '$(_EmccVersionRaw)'" Condition="'$(_EmccVersion)' == '' or '$(_EmccVersionHash)' == ''" /> <WriteLinesToFile File="$(NativeBinDir)src\emcc-props.json" Lines="$(_EmccPropsJson)" Overwrite="true" WriteOnlyWhenDifferent="true" /> </Target> <!-- This is a documented target that is invoked by developers in their innerloop work. --> <Target Name="BuildWasmRuntimes" AfterTargets="Build" DependsOnTargets="GenerateEmccPropsAndRspFiles;BuildPInvokeTable;BundleTimeZones;InstallNpmPackages;BuildWithRollup"> <ItemGroup> <ICULibNativeFiles Include="$(ICULibDir)/libicuuc.a; $(ICULibDir)/libicui18n.a" /> <ICULibFiles Include="$(ICULibDir)/*.dat" /> </ItemGroup> <PropertyGroup> <PInvokeTableFile>$(ArtifactsObjDir)wasm/pinvoke-table.h</PInvokeTableFile> <CMakeConfigurationEmccFlags Condition="'$(Configuration)' == 'Debug'">-g -Os -s -DDEBUG=1 -DENABLE_AOT_PROFILER=1</CMakeConfigurationEmccFlags> <CMakeConfigurationEmccFlags Condition="'$(Configuration)' == 'Release'">-Oz</CMakeConfigurationEmccFlags> <CMakeConfigurationLinkFlags Condition="'$(Configuration)' == 'Debug'" >$(CMakeConfigurationEmccFlags)</CMakeConfigurationLinkFlags> <CMakeConfigurationLinkFlags Condition="'$(Configuration)' == 'Release'">-O2</CMakeConfigurationLinkFlags> <CMakeConfigurationLinkFlags >$(CMakeConfigurationLinkFlags) --emit-symbol-map</CMakeConfigurationLinkFlags> <CMakeConfigurationEmsdkPath Condition="'$(Configuration)' == 'Release'"> -DEMSDK_PATH=&quot;$(EMSDK_PATH.TrimEnd('\/'))&quot;</CMakeConfigurationEmsdkPath> <CMakeBuildRuntimeConfigureCmd>emcmake cmake $(MSBuildThisFileDirectory)runtime</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DCMAKE_BUILD_TYPE=$(Configuration)</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_EMCC_FLAGS=&quot;$(CMakeConfigurationEmccFlags)&quot;</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_LINK_FLAGS=&quot;$(CMakeConfigurationLinkFlags)&quot;</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DMONO_INCLUDES=&quot;$(MonoArtifactsPath)include/mono-2.0&quot;</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DMONO_OBJ_INCLUDES=&quot;$(MonoObjDir.TrimEnd('\/'))&quot;</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DICU_LIB_DIR=&quot;$(ICULibDir.TrimEnd('\/'))&quot;</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DMONO_ARTIFACTS_DIR=&quot;$(MonoArtifactsPath.TrimEnd('\/'))&quot;</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) -DNATIVE_BIN_DIR=&quot;$(NativeBinDir.TrimEnd('\/'))&quot;</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd>$(CMakeBuildRuntimeConfigureCmd) $(CMakeConfigurationEmsdkPath)</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd Condition="'$(OS)' == 'Windows_NT'">call &quot;$(RepositoryEngineeringDir)native\init-vs-env.cmd&quot; &amp;&amp; call &quot;$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.bat'))&quot; &amp;&amp; $(CMakeBuildRuntimeConfigureCmd)</CMakeBuildRuntimeConfigureCmd> <CMakeBuildRuntimeConfigureCmd Condition="'$(OS)' != 'Windows_NT'">bash -c 'source $(EMSDK_PATH)/emsdk_env.sh 2>&amp;1 &amp;&amp; $(CMakeBuildRuntimeConfigureCmd)'</CMakeBuildRuntimeConfigureCmd> <CMakeOptions Condition="'$(MonoVerboseBuild)' != ''">-v</CMakeOptions> <CMakeBuildRuntimeCmd>cmake --build . --config $(Configuration) $(CmakeOptions)</CMakeBuildRuntimeCmd> <CMakeBuildRuntimeCmd Condition="'$(OS)' == 'Windows_NT'">call &quot;$(RepositoryEngineeringDir)native\init-vs-env.cmd&quot; &amp;&amp; call &quot;$([MSBuild]::NormalizePath('$(EMSDK_PATH)', 'emsdk_env.bat'))&quot; &amp;&amp; $(CMakeBuildRuntimeCmd)</CMakeBuildRuntimeCmd> <CMakeBuildRuntimeCmd Condition="'$(OS)' != 'Windows_NT'">bash -c 'source $(EMSDK_PATH)/emsdk_env.sh 2>&amp;1 &amp;&amp; $(CMakeBuildRuntimeCmd)'</CMakeBuildRuntimeCmd> </PropertyGroup> <Copy SourceFiles="$(PInvokeTableFile)" DestinationFolder="$(MonoObjDir)" SkipUnchangedFiles="true" /> <Copy SourceFiles="runtime/driver.c; runtime/pinvoke.c; runtime/corebindings.c; $(SharedNativeRoot)libs\System.Native\pal_random.lib.js;" DestinationFolder="$(NativeBinDir)src" SkipUnchangedFiles="true" /> <Copy SourceFiles="runtime/cjs/dotnet.cjs.pre.js; runtime/cjs/dotnet.cjs.lib.js; runtime/cjs/dotnet.cjs.post.js; runtime/cjs/dotnet.cjs.extpost.js;" DestinationFolder="$(NativeBinDir)src/cjs" SkipUnchangedFiles="true" /> <Copy SourceFiles="runtime/es6/dotnet.es6.pre.js; runtime/es6/dotnet.es6.lib.js; runtime/es6/dotnet.es6.post.js;" DestinationFolder="$(NativeBinDir)src/es6" SkipUnchangedFiles="true" /> <Copy SourceFiles="runtime\pinvoke.h" DestinationFolder="$(NativeBinDir)include\wasm" SkipUnchangedFiles="true" /> <Copy SourceFiles="@(ICULibFiles); @(ICULibNativeFiles);" DestinationFolder="$(NativeBinDir)" SkipUnchangedFiles="true" /> <Exec Command="$(CMakeBuildRuntimeConfigureCmd)" WorkingDirectory="$(NativeBinDir)" /> <Exec Command="$(CMakeBuildRuntimeCmd)" WorkingDirectory="$(NativeBinDir)" /> <ItemGroup> <IcuDataFiles Include="$(NativeBinDir)*.dat" /> <WasmSrcFiles Include="$(NativeBinDir)src\*.c; $(NativeBinDir)src\*.js; $(_EmccDefaultsRspPath); $(_EmccCompileRspPath); $(_EmccLinkRspPath); $(NativeBinDir)src\emcc-props.json" /> <WasmSrcFilesCjs Include="$(NativeBinDir)src\cjs\*.js;" /> <WasmSrcFilesEs6 Include="$(NativeBinDir)src\es6\*.js;" /> <WasmHeaderFiles Include="$(NativeBinDir)include\wasm\*.h" /> </ItemGroup> <Copy SourceFiles="$(NativeBinDir)dotnet.js; $(NativeBinDir)dotnet.d.ts; $(NativeBinDir)package.json; $(NativeBinDir)dotnet.wasm; $(NativeBinDir)dotnet.timezones.blat" DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)" SkipUnchangedFiles="true" /> <Copy SourceFiles="$(NativeBinDir)dotnet.js.symbols" DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)" SkipUnchangedFiles="true" /> <Copy SourceFiles="@(IcuDataFiles);@(ICULibNativeFiles)" DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)" SkipUnchangedFiles="true" /> <Copy SourceFiles="@(WasmSrcFiles)" DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)src" SkipUnchangedFiles="true" /> <Copy SourceFiles="@(WasmSrcFilesCjs)" DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)src\cjs" SkipUnchangedFiles="true" /> <Copy SourceFiles="@(WasmSrcFilesEs6)" DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)src\es6" SkipUnchangedFiles="true" /> <Copy SourceFiles="@(WasmHeaderFiles)" DestinationFolder="$(MicrosoftNetCoreAppRuntimePackNativeDir)include\wasm" SkipUnchangedFiles="true" /> </Target> <Target Name="InstallNpmPackages" Inputs="$(MonoProjectRoot)wasm/runtime/package.json" Outputs="$(MonoProjectRoot)wasm/runtime/node_modules/.npm-stamp" > <!-- install typescript and rollup --> <RunWithEmSdkEnv Condition="'$(ContinuousIntegrationBuild)' == 'true'" Command="npm ci" EmSdkPath="$(EMSDK_PATH)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoProjectRoot)wasm/runtime/"/> <RunWithEmSdkEnv Condition="'$(ContinuousIntegrationBuild)' == 'true'" Command="npm audit" EmSdkPath="$(EMSDK_PATH)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoProjectRoot)wasm/runtime/"/> <!-- npm install is faster on dev machine as it doesn't wipe node_modules folder --> <RunWithEmSdkEnv Condition="'$(ContinuousIntegrationBuild)' != 'true'" Command="npm install" EmSdkPath="$(EMSDK_PATH)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoProjectRoot)wasm/runtime/"/> <Touch Files="$(MonoProjectRoot)wasm/runtime/node_modules/.npm-stamp" AlwaysCreate="true" /> </Target> <ItemGroup> <_RollupInputs Include="$(MonoProjectRoot)wasm/runtime/*.ts"/> <_RollupInputs Include="$(MonoProjectRoot)wasm/runtime/types/*.ts"/> <_RollupInputs Include="$(MonoProjectRoot)wasm/runtimetypes/*.d.ts"/> <_RollupInputs Include="$(MonoProjectRoot)wasm/runtime/*.json"/> <_RollupInputs Include="$(MonoProjectRoot)wasm/runtime/*.js"/> </ItemGroup> <Target Name="BuildWithRollup" Inputs="@(_RollupInputs)" Outputs="$(NativeBinDir).rollup-stamp" > <!-- code style check --> <RunWithEmSdkEnv Command="npm run lint" StandardOutputImportance="High" EmSdkPath="$(EMSDK_PATH)" WorkingDirectory="$(MonoProjectRoot)wasm/runtime/"/> <!-- compile typescript --> <RunWithEmSdkEnv Command="npm run rollup -- --environment Configuration:$(Configuration),NativeBinDir:$(NativeBinDir),ProductVersion:$(ProductVersion)" EmSdkPath="$(EMSDK_PATH)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(MonoProjectRoot)wasm/runtime/"/> <Copy SourceFiles="runtime/package.json;" DestinationFolder="$(NativeBinDir)" SkipUnchangedFiles="true" /> <!-- set version --> <RunWithEmSdkEnv Command="npm version $(PackageVersion)" EmSdkPath="$(EMSDK_PATH)" WorkingDirectory="$(NativeBinDir)"/> <Touch Files="$(NativeBinDir).rollup-stamp" AlwaysCreate="true" /> </Target> </Project>
1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Methodical/eh/interactions/switchinfinally_r.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="switchinfinally.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\..\common\eh_common.csproj" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="switchinfinally.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\..\common\eh_common.csproj" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/SIMD/StoreElement_ro.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="StoreElement.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="StoreElement.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/CodeGenBringUpTests/Le1_do.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="Le1.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="Le1.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/libraries/System.Threading.Tasks.Parallel/ref/System.Threading.Tasks.Parallel.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> <Nullable>enable</Nullable> </PropertyGroup> <ItemGroup> <Compile Include="System.Threading.Tasks.Parallel.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" /> <ProjectReference Include="..\..\System.Collections.Concurrent\ref\System.Collections.Concurrent.csproj" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> <Nullable>enable</Nullable> </PropertyGroup> <ItemGroup> <Compile Include="System.Threading.Tasks.Parallel.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" /> <ProjectReference Include="..\..\System.Collections.Concurrent\ref\System.Collections.Concurrent.csproj" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Regression/Dev14/DevDiv_876169/DevDiv_876169_r.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="DevDiv_876169.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="DevDiv_876169.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/libraries/System.Threading.Channels/tests/System.Threading.Channels.Tests.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkMinimum)</TargetFrameworks> <DebuggerSupport Condition="'$(DebuggerSupport)' == '' and '$(TargetOS)' == 'Browser'">true</DebuggerSupport> </PropertyGroup> <ItemGroup> <Compile Include="BoundedChannelTests.cs" /> <Compile Include="ChannelClosedExceptionTests.cs" /> <Compile Include="ChannelTestBase.cs" /> <Compile Include="ChannelTests.cs" /> <Compile Include="TestBase.cs" /> <Compile Include="UnboundedChannelTests.cs" /> <Compile Include="DebugAttributeTests.cs" /> <Compile Include="$(CommonTestPath)System\Diagnostics\DebuggerAttributes.cs" Link="Common\System\Diagnostics\DebuggerAttributes.cs" /> </ItemGroup> <ItemGroup Condition="'$(TargetFramework)' == '$(NetCoreAppCurrent)'"> <Compile Include="Stress.cs" /> <Compile Include="ChannelClosedExceptionTests.netcoreapp.cs" /> <Compile Include="ChannelTestBase.netcoreapp.cs" /> </ItemGroup> <ItemGroup Condition="'$(TargetFramework)' == '$(NetFrameworkMinimum)'"> <ProjectReference Include="..\src\System.Threading.Channels.csproj" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkMinimum)</TargetFrameworks> <DebuggerSupport Condition="'$(DebuggerSupport)' == '' and '$(TargetOS)' == 'Browser'">true</DebuggerSupport> </PropertyGroup> <ItemGroup> <Compile Include="BoundedChannelTests.cs" /> <Compile Include="ChannelClosedExceptionTests.cs" /> <Compile Include="ChannelTestBase.cs" /> <Compile Include="ChannelTests.cs" /> <Compile Include="TestBase.cs" /> <Compile Include="UnboundedChannelTests.cs" /> <Compile Include="DebugAttributeTests.cs" /> <Compile Include="$(CommonTestPath)System\Diagnostics\DebuggerAttributes.cs" Link="Common\System\Diagnostics\DebuggerAttributes.cs" /> </ItemGroup> <ItemGroup Condition="'$(TargetFramework)' == '$(NetCoreAppCurrent)'"> <Compile Include="Stress.cs" /> <Compile Include="ChannelClosedExceptionTests.netcoreapp.cs" /> <Compile Include="ChannelTestBase.netcoreapp.cs" /> </ItemGroup> <ItemGroup Condition="'$(TargetFramework)' == '$(NetFrameworkMinimum)'"> <ProjectReference Include="..\src\System.Threading.Channels.csproj" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/libraries/Microsoft.Extensions.FileProviders.Composite/ref/Microsoft.Extensions.FileProviders.Composite.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <RootNamespace>Microsoft.Extensions.FileProviders</RootNamespace> <TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks> <Nullable>enable</Nullable> </PropertyGroup> <ItemGroup> <Compile Include="Microsoft.Extensions.FileProviders.Composite.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.FileProviders.Abstractions\ref\Microsoft.Extensions.FileProviders.Abstractions.csproj" /> <ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.Primitives\ref\Microsoft.Extensions.Primitives.csproj" /> </ItemGroup> <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(TargetFramework)' != '$(NetCoreAppCurrent)'"> <Reference Include="System.Runtime" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <RootNamespace>Microsoft.Extensions.FileProviders</RootNamespace> <TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks> <Nullable>enable</Nullable> </PropertyGroup> <ItemGroup> <Compile Include="Microsoft.Extensions.FileProviders.Composite.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.FileProviders.Abstractions\ref\Microsoft.Extensions.FileProviders.Abstractions.csproj" /> <ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.Primitives\ref\Microsoft.Extensions.Primitives.csproj" /> </ItemGroup> <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(TargetFramework)' != '$(NetCoreAppCurrent)'"> <Reference Include="System.Runtime" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/opt/Devirtualization/box1.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="box1.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="box1.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/jit64/valuetypes/nullable/castclass/generics/castclass-generics013.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="castclass-generics013.cs" /> <Compile Include="..\structdef.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="castclass-generics013.cs" /> <Compile Include="..\structdef.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/baseservices/threading/generics/TimerCallback/thread26.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="thread26.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="thread26.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/opt/Inline/tests/trycatch.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. --> <DebugType>None</DebugType> <NoStandardLib>True</NoStandardLib> <Noconfig>True</Noconfig> </PropertyGroup> <ItemGroup> <Compile Include="trycatch.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. --> <DebugType>None</DebugType> <NoStandardLib>True</NoStandardLib> <Noconfig>True</Noconfig> </PropertyGroup> <ItemGroup> <Compile Include="trycatch.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/GC/Scenarios/GCSimulator/GCSimulator_305.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <GCStressIncompatible>true</GCStressIncompatible> <CLRTestExecutionArguments>-t 3 -tp 0 -dz 17 -sdz 8500 -dc 10000 -sdc 5000 -lt 5 -f -dp 0.8 -dw 0.4</CLRTestExecutionArguments> <IsGCSimulatorTest>true</IsGCSimulatorTest> <CLRTestProjectToRun>GCSimulator.csproj</CLRTestProjectToRun> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="GCSimulator.cs" /> <Compile Include="lifetimefx.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <GCStressIncompatible>true</GCStressIncompatible> <CLRTestExecutionArguments>-t 3 -tp 0 -dz 17 -sdz 8500 -dc 10000 -sdc 5000 -lt 5 -f -dp 0.8 -dw 0.4</CLRTestExecutionArguments> <IsGCSimulatorTest>true</IsGCSimulatorTest> <CLRTestProjectToRun>GCSimulator.csproj</CLRTestProjectToRun> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="GCSimulator.cs" /> <Compile Include="lifetimefx.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/libraries/System.Runtime.InteropServices/src/System.Runtime.InteropServices.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <IsPartialFacadeAssembly>true</IsPartialFacadeAssembly> <Nullable>enable</Nullable> <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> </PropertyGroup> <ItemGroup> <Compile Include="System\Runtime\CompilerServices\IDispatchConstantAttribute.cs" /> <Compile Include="System\Runtime\CompilerServices\IUnknownConstantAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\ADVF.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\DATADIR.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\DVASPECT.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\FORMATETC.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\IAdviseSink.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\IDataObject.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\IEnumFormatETC.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\IEnumSTATDATA.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\STATDATA.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\STGMEDIUM.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\TYMED.cs" /> <Compile Include="System\Runtime\InteropServices\AssemblyRegistrationFlags.cs" /> <Compile Include="System\Runtime\InteropServices\AutomationProxyAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\ComAliasNameAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\ComAwareEventInfo.cs" /> <Compile Include="System\Runtime\InteropServices\ComCompatibleVersionAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\ComConversionLossAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\ComRegisterFunctionAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\ComUnregisterFunctionAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\ExporterEventKind.cs" /> <Compile Include="System\Runtime\InteropServices\HandleCollector.cs" /> <Compile Include="System\Runtime\InteropServices\IDispatchImplAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\IDispatchImplType.cs" /> <Compile Include="System\Runtime\InteropServices\ImportedFromTypeLibAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\ManagedToNativeComInteropStubAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\PrimaryInteropAssemblyAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\RegistrationClassContext.cs" /> <Compile Include="System\Runtime\InteropServices\RegistrationConnectionType.cs" /> <Compile Include="System\Runtime\InteropServices\RuntimeEnvironment.cs" /> <Compile Include="System\Runtime\InteropServices\SetWin32ContextInIDispatchAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\TypeLibFuncAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\TypeLibFuncFlags.cs" /> <Compile Include="System\Runtime\InteropServices\TypeLibImportClassAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\TypeLibTypeAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\TypeLibTypeFlags.cs" /> <Compile Include="System\Runtime\InteropServices\TypeLibVarAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\TypeLibVarFlags.cs" /> <Compile Include="System\Runtime\InteropServices\TypeLibVersionAttribute.cs" /> <Compile Include="System\Security\SecureStringMarshal.cs" /> <Compile Include="$(CommonPath)System\Obsoletions.cs" Link="Common\System\Obsoletions.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="$(CoreLibProject)" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <IsPartialFacadeAssembly>true</IsPartialFacadeAssembly> <Nullable>enable</Nullable> <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> </PropertyGroup> <ItemGroup> <Compile Include="System\Runtime\CompilerServices\IDispatchConstantAttribute.cs" /> <Compile Include="System\Runtime\CompilerServices\IUnknownConstantAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\ADVF.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\DATADIR.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\DVASPECT.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\FORMATETC.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\IAdviseSink.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\IDataObject.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\IEnumFormatETC.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\IEnumSTATDATA.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\STATDATA.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\STGMEDIUM.cs" /> <Compile Include="System\Runtime\InteropServices\ComTypes\TYMED.cs" /> <Compile Include="System\Runtime\InteropServices\AssemblyRegistrationFlags.cs" /> <Compile Include="System\Runtime\InteropServices\AutomationProxyAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\ComAliasNameAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\ComAwareEventInfo.cs" /> <Compile Include="System\Runtime\InteropServices\ComCompatibleVersionAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\ComConversionLossAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\ComRegisterFunctionAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\ComUnregisterFunctionAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\ExporterEventKind.cs" /> <Compile Include="System\Runtime\InteropServices\HandleCollector.cs" /> <Compile Include="System\Runtime\InteropServices\IDispatchImplAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\IDispatchImplType.cs" /> <Compile Include="System\Runtime\InteropServices\ImportedFromTypeLibAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\ManagedToNativeComInteropStubAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\PrimaryInteropAssemblyAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\RegistrationClassContext.cs" /> <Compile Include="System\Runtime\InteropServices\RegistrationConnectionType.cs" /> <Compile Include="System\Runtime\InteropServices\RuntimeEnvironment.cs" /> <Compile Include="System\Runtime\InteropServices\SetWin32ContextInIDispatchAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\TypeLibFuncAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\TypeLibFuncFlags.cs" /> <Compile Include="System\Runtime\InteropServices\TypeLibImportClassAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\TypeLibTypeAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\TypeLibTypeFlags.cs" /> <Compile Include="System\Runtime\InteropServices\TypeLibVarAttribute.cs" /> <Compile Include="System\Runtime\InteropServices\TypeLibVarFlags.cs" /> <Compile Include="System\Runtime\InteropServices\TypeLibVersionAttribute.cs" /> <Compile Include="System\Security\SecureStringMarshal.cs" /> <Compile Include="$(CommonPath)System\Obsoletions.cs" Link="Common\System\Obsoletions.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="$(CoreLibProject)" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/GC/API/GC/GetGeneration_fail.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestExecutionArguments /> </PropertyGroup> <PropertyGroup> <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. --> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="GetGeneration_fail.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestExecutionArguments /> </PropertyGroup> <PropertyGroup> <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. --> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="GetGeneration_fail.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Methodical/nonvirtualcall/tailcall.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="tailcall.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="tailcall.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/readytorun/crossgen2/smoketest.targets
<?xml version="1.0" encoding="utf-8"?> <Project> <PropertyGroup> <OutputType>exe</OutputType> <CLRTestKind>BuildAndRun</CLRTestKind> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <ItemGroup> <ProjectReference Include=".\helperdll.csproj" /> <ProjectReference Include=".\helperildll.ilproj" /> </ItemGroup> <ItemGroup> <Compile Include="Program.cs" /> </ItemGroup> </Project>
<?xml version="1.0" encoding="utf-8"?> <Project> <PropertyGroup> <OutputType>exe</OutputType> <CLRTestKind>BuildAndRun</CLRTestKind> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <ItemGroup> <ProjectReference Include=".\helperdll.csproj" /> <ProjectReference Include=".\helperildll.ilproj" /> </ItemGroup> <ItemGroup> <Compile Include="Program.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/GC/API/GC/TotalMemory2.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> <!-- This test is failing under GCStress variations, so disabling it under GCStress till the issue is investigated: Issue: https://github.com/dotnet/runtime/issues/63860 --> <GCStressIncompatible>true</GCStressIncompatible> </PropertyGroup> <PropertyGroup> <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. --> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="TotalMemory2.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> <!-- This test is failing under GCStress variations, so disabling it under GCStress till the issue is investigated: Issue: https://github.com/dotnet/runtime/issues/63860 --> <GCStressIncompatible>true</GCStressIncompatible> </PropertyGroup> <PropertyGroup> <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. --> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="TotalMemory2.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/opt/ObjectStackAllocation/ObjectStackAllocationTests.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).cs" /> </ItemGroup> <PropertyGroup> <CrossGen2TestExtraArguments>--codegenopt JitObjectStackAllocation=1</CrossGen2TestExtraArguments> <CLRTestBatchPreCommands><![CDATA[ $(CLRTestBatchPreCommands) set COMPlus_TieredCompilation=0 set COMPlus_ProfApi_RejitOnAttach=0 set COMPlus_JITMinOpts=0 set COMPlus_JitDebuggable=0 set COMPlus_JitStressModeNamesNot=STRESS_RANDOM_INLINE,STRESS_MIN_OPTS set COMPlus_JitObjectStackAllocation=1 ]]></CLRTestBatchPreCommands> <BashCLRTestPreCommands><![CDATA[ $(BashCLRTestPreCommands) export COMPlus_TieredCompilation=0 export COMPlus_ProfApi_RejitOnAttach=0 export COMPlus_JITMinOpts=0 export COMPlus_JitDebuggable=0 export COMPlus_JitStressModeNamesNot=STRESS_RANDOM_INLINE,STRESS_MIN_OPTS export COMPlus_JitObjectStackAllocation=1 ]]></BashCLRTestPreCommands> </PropertyGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).cs" /> </ItemGroup> <PropertyGroup> <CrossGen2TestExtraArguments>--codegenopt JitObjectStackAllocation=1</CrossGen2TestExtraArguments> <CLRTestBatchPreCommands><![CDATA[ $(CLRTestBatchPreCommands) set COMPlus_TieredCompilation=0 set COMPlus_ProfApi_RejitOnAttach=0 set COMPlus_JITMinOpts=0 set COMPlus_JitDebuggable=0 set COMPlus_JitStressModeNamesNot=STRESS_RANDOM_INLINE,STRESS_MIN_OPTS set COMPlus_JitObjectStackAllocation=1 ]]></CLRTestBatchPreCommands> <BashCLRTestPreCommands><![CDATA[ $(BashCLRTestPreCommands) export COMPlus_TieredCompilation=0 export COMPlus_ProfApi_RejitOnAttach=0 export COMPlus_JITMinOpts=0 export COMPlus_JitDebuggable=0 export COMPlus_JitStressModeNamesNot=STRESS_RANDOM_INLINE,STRESS_MIN_OPTS export COMPlus_JitObjectStackAllocation=1 ]]></BashCLRTestPreCommands> </PropertyGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/jit64/opt/rngchk/RngchkStress1_o.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="RngchkStress1.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="RngchkStress1.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/jit64/valuetypes/nullable/castclass/castclass/castclass006.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="castclass006.cs" /> <Compile Include="..\structdef.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="castclass006.cs" /> <Compile Include="..\structdef.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Methodical/int64/signed/s_ldc_mul_d.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="s_ldc_mul.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="s_ldc_mul.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/LibraryImportGenerator.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <AssemblyName>Microsoft.Interop.LibraryImportGenerator</AssemblyName> <TargetFramework>netstandard2.0</TargetFramework> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <LangVersion>Preview</LangVersion> <Nullable>enable</Nullable> <RootNamespace>Microsoft.Interop</RootNamespace> <IsRoslynComponent>true</IsRoslynComponent> <RunAnalyzers>true</RunAnalyzers> <!-- Disable RS2008: Enable analyzer release tracking Diagnostics in runtime use a different mechanism (docs/project/list-of-diagnostics.md) --> <NoWarn>RS2008;$(NoWarn)</NoWarn> <!-- Packaging properties --> <!-- In the future LibraryImportGenerator might ship as part of a package, but meanwhile disable packaging. --> <IsPackable>false</IsPackable> <IncludeBuildOutput>false</IncludeBuildOutput> <SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking> <PackageProjectUrl>https://github.com/dotnet/runtime/tree/main/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator</PackageProjectUrl> <Description>LibraryImportGenerator</Description> <PackageTags>LibraryImportGenerator, analyzers</PackageTags> <!-- TODO: Enable when this package shipped. --> <DisablePackageBaselineValidation>true</DisablePackageBaselineValidation> </PropertyGroup> <ItemGroup> <!-- Code included from System.Runtime.InteropServices --> <Compile Include="$(CommonPath)System\Runtime\InteropServices\StringMarshalling.cs" Link="Production\StringMarshalling.cs" /> </ItemGroup> <ItemGroup> <Compile Update="Resources.Designer.cs" DesignTime="True" AutoGen="True" DependentUpon="Resources.resx" /> </ItemGroup> <ItemGroup> <EmbeddedResource Update="Resources.resx" Generator="ResXFileCodeGenerator" LastGenOutput="Resources.Designer.cs" /> </ItemGroup> <ItemGroup> <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="$(MicrosoftCodeAnalysisVersion)" PrivateAssets="all" /> <PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="$(MicrosoftCodeAnalysisAnalyzersVersion)" PrivateAssets="all" /> </ItemGroup> <ItemGroup> <None Include="$(TargetPath)" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" /> <None Include="$(AssemblyName).props" Pack="true" PackagePath="build" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\Microsoft.Interop.SourceGeneration\Microsoft.Interop.SourceGeneration.csproj" Pack="true" PackagePath="analyzers/dotnet/cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <AssemblyName>Microsoft.Interop.LibraryImportGenerator</AssemblyName> <TargetFramework>netstandard2.0</TargetFramework> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <LangVersion>Preview</LangVersion> <Nullable>enable</Nullable> <RootNamespace>Microsoft.Interop</RootNamespace> <IsRoslynComponent>true</IsRoslynComponent> <RunAnalyzers>true</RunAnalyzers> <!-- Disable RS2008: Enable analyzer release tracking Diagnostics in runtime use a different mechanism (docs/project/list-of-diagnostics.md) --> <NoWarn>RS2008;$(NoWarn)</NoWarn> <!-- Packaging properties --> <!-- In the future LibraryImportGenerator might ship as part of a package, but meanwhile disable packaging. --> <IsPackable>false</IsPackable> <IncludeBuildOutput>false</IncludeBuildOutput> <SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking> <PackageProjectUrl>https://github.com/dotnet/runtime/tree/main/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator</PackageProjectUrl> <Description>LibraryImportGenerator</Description> <PackageTags>LibraryImportGenerator, analyzers</PackageTags> <!-- TODO: Enable when this package shipped. --> <DisablePackageBaselineValidation>true</DisablePackageBaselineValidation> </PropertyGroup> <ItemGroup> <!-- Code included from System.Runtime.InteropServices --> <Compile Include="$(CommonPath)System\Runtime\InteropServices\StringMarshalling.cs" Link="Production\StringMarshalling.cs" /> </ItemGroup> <ItemGroup> <Compile Update="Resources.Designer.cs" DesignTime="True" AutoGen="True" DependentUpon="Resources.resx" /> </ItemGroup> <ItemGroup> <EmbeddedResource Update="Resources.resx" Generator="ResXFileCodeGenerator" LastGenOutput="Resources.Designer.cs" /> </ItemGroup> <ItemGroup> <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="$(MicrosoftCodeAnalysisVersion)" PrivateAssets="all" /> <PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="$(MicrosoftCodeAnalysisAnalyzersVersion)" PrivateAssets="all" /> </ItemGroup> <ItemGroup> <None Include="$(TargetPath)" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" /> <None Include="$(AssemblyName).props" Pack="true" PackagePath="build" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\Microsoft.Interop.SourceGeneration\Microsoft.Interop.SourceGeneration.csproj" Pack="true" PackagePath="analyzers/dotnet/cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Methodical/NaN/r8NaNadd_cs_do.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="r8NaNadd.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="r8NaNadd.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/libraries/Microsoft.Bcl.AsyncInterfaces/ref/Microsoft.Bcl.AsyncInterfaces.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>netstandard2.0;$(NetFrameworkMinimum);netstandard2.1</TargetFrameworks> </PropertyGroup> <ItemGroup Condition="'$(TargetFramework)' != 'netstandard2.1'"> <Compile Include="Microsoft.Bcl.AsyncInterfaces.cs" /> </ItemGroup> <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'"> <Compile Include="Microsoft.Bcl.AsyncInterfaces.Forwards.cs" /> </ItemGroup> <ItemGroup Condition="'$(TargetFramework)' != 'netstandard2.1'"> <PackageReference Include="System.Threading.Tasks.Extensions" Version="$(SystemThreadingTasksExtensionsVersion)" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>netstandard2.0;$(NetFrameworkMinimum);netstandard2.1</TargetFrameworks> </PropertyGroup> <ItemGroup Condition="'$(TargetFramework)' != 'netstandard2.1'"> <Compile Include="Microsoft.Bcl.AsyncInterfaces.cs" /> </ItemGroup> <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'"> <Compile Include="Microsoft.Bcl.AsyncInterfaces.Forwards.cs" /> </ItemGroup> <ItemGroup Condition="'$(TargetFramework)' != 'netstandard2.1'"> <PackageReference Include="System.Threading.Tasks.Extensions" Version="$(SystemThreadingTasksExtensionsVersion)" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/SIMD/VectorSet_r.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize /> </PropertyGroup> <ItemGroup> <Compile Include="VectorSet.cs" /> <Compile Include="VectorUtil.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize /> </PropertyGroup> <ItemGroup> <Compile Include="VectorSet.cs" /> <Compile Include="VectorUtil.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Directed/StructPromote/SP2b.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="SP2b.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="SP2b.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/libraries/Microsoft.Extensions.DependencyInjection/ref/Microsoft.Extensions.DependencyInjection.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppMinimum);netstandard2.1;netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks> <Nullable>enable</Nullable> </PropertyGroup> <ItemGroup> <Compile Include="Microsoft.Extensions.DependencyInjection.cs" /> <Compile Include="Microsoft.Extensions.DependencyInjection.Forwards.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.DependencyInjection.Abstractions\ref\Microsoft.Extensions.DependencyInjection.Abstractions.csproj" /> </ItemGroup> <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(TargetFramework)' != '$(NetCoreAppCurrent)'"> <Reference Include="System.ComponentModel" /> <Reference Include="System.Runtime" /> </ItemGroup> <ItemGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netstandard2.1'))"> <PackageReference Include="System.Threading.Tasks.Extensions" Version="$(SystemThreadingTasksExtensionsVersion)" /> <ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Bcl.AsyncInterfaces\ref\Microsoft.Bcl.AsyncInterfaces.csproj" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppMinimum);netstandard2.1;netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks> <Nullable>enable</Nullable> </PropertyGroup> <ItemGroup> <Compile Include="Microsoft.Extensions.DependencyInjection.cs" /> <Compile Include="Microsoft.Extensions.DependencyInjection.Forwards.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.DependencyInjection.Abstractions\ref\Microsoft.Extensions.DependencyInjection.Abstractions.csproj" /> </ItemGroup> <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(TargetFramework)' != '$(NetCoreAppCurrent)'"> <Reference Include="System.ComponentModel" /> <Reference Include="System.Runtime" /> </ItemGroup> <ItemGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netstandard2.1'))"> <PackageReference Include="System.Threading.Tasks.Extensions" Version="$(SystemThreadingTasksExtensionsVersion)" /> <ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Bcl.AsyncInterfaces\ref\Microsoft.Bcl.AsyncInterfaces.csproj" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Regression/CLR-x86-JIT/V1-M11-Beta1/b48872/b48872.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/jit64/valuetypes/nullable/box-unbox/value/box-unbox-value009.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="box-unbox-value009.cs" /> <Compile Include="..\structdef.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="box-unbox-value009.cs" /> <Compile Include="..\structdef.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Methodical/AsgOp/r8/r8flat_cs_ro.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="r8flat.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="r8flat.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/baseservices/threading/generics/WaitCallback/thread23.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="thread23.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="thread23.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/libraries/System.Runtime.Handles/src/System.Runtime.Handles.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <IsPartialFacadeAssembly>true</IsPartialFacadeAssembly> <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> <Nullable>enable</Nullable> </PropertyGroup> <ItemGroup> <Reference Include="System.Runtime" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <IsPartialFacadeAssembly>true</IsPartialFacadeAssembly> <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> <Nullable>enable</Nullable> </PropertyGroup> <ItemGroup> <Reference Include="System.Runtime" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/libraries/System.Reflection.TypeExtensions/src/System.Reflection.TypeExtensions.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <IsPartialFacadeAssembly>true</IsPartialFacadeAssembly> <Nullable>enable</Nullable> <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> </PropertyGroup> <ItemGroup> <Compile Include="System\Reflection\TypeExtensions.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="$(CoreLibProject)" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <IsPartialFacadeAssembly>true</IsPartialFacadeAssembly> <Nullable>enable</Nullable> <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> </PropertyGroup> <ItemGroup> <Compile Include="System\Reflection\TypeExtensions.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="$(CoreLibProject)" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Directed/callconv/ThisCall/ThisCallTest.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <ItemGroup> <Compile Include="*.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="../CMakeLists.txt" /> <ProjectReference Include="$(TestSourceDir)Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <ItemGroup> <Compile Include="*.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="../CMakeLists.txt" /> <ProjectReference Include="$(TestSourceDir)Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/SIMD/MinMax_r.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize /> </PropertyGroup> <ItemGroup> <Compile Include="MinMax.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize /> </PropertyGroup> <ItemGroup> <Compile Include="MinMax.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Regression/CLR-x86-JIT/V1-M09.5-PDC/b14716/b14716.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Methodical/MDArray/DataTypes/int_cs_ro.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="int.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="int.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Regression/JitBlue/GitHub_20657/GitHub_20657.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/HardwareIntrinsics/X86/Regression/GitHub_17073/GitHub_17073.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <PropertyGroup> <DebugType>Embedded</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <PropertyGroup> <DebugType>Embedded</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/GC/Scenarios/GCSimulator/GCSimulator_281.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <GCStressIncompatible>true</GCStressIncompatible> <CLRTestExecutionArguments>-t 3 -tp 0 -dz 17 -sdz 8500 -dc 10000 -sdc 5000 -lt 3 -dp 0.0 -dw 0.4</CLRTestExecutionArguments> <IsGCSimulatorTest>true</IsGCSimulatorTest> <CLRTestProjectToRun>GCSimulator.csproj</CLRTestProjectToRun> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="GCSimulator.cs" /> <Compile Include="lifetimefx.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <GCStressIncompatible>true</GCStressIncompatible> <CLRTestExecutionArguments>-t 3 -tp 0 -dz 17 -sdz 8500 -dc 10000 -sdc 5000 -lt 3 -dp 0.0 -dw 0.4</CLRTestExecutionArguments> <IsGCSimulatorTest>true</IsGCSimulatorTest> <CLRTestProjectToRun>GCSimulator.csproj</CLRTestProjectToRun> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="GCSimulator.cs" /> <Compile Include="lifetimefx.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/libraries/System.Runtime.Loader/tests/DefaultContext/System.Runtime.Loader.DefaultContext.Tests.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> <TestRuntime>true</TestRuntime> <!-- LoadInDefaultContext test relies on no deps.json --> <GenerateDependencyFile>false</GenerateDependencyFile> </PropertyGroup> <ItemGroup> <Compile Include="DefaultLoadContextTest.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="../System.Runtime.Loader.Noop.Assembly/System.Runtime.Loader.Noop.Assembly.csproj" ReferenceOutputAssembly="false" OutputItemType="ContentWithTargetPath" CopyToOutputDirectory="PreserveNewest" TargetPath="System.Runtime.Loader.Noop.Assembly_test.dll" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> <TestRuntime>true</TestRuntime> <!-- LoadInDefaultContext test relies on no deps.json --> <GenerateDependencyFile>false</GenerateDependencyFile> </PropertyGroup> <ItemGroup> <Compile Include="DefaultLoadContextTest.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="../System.Runtime.Loader.Noop.Assembly/System.Runtime.Loader.Noop.Assembly.csproj" ReferenceOutputAssembly="false" OutputItemType="ContentWithTargetPath" CopyToOutputDirectory="PreserveNewest" TargetPath="System.Runtime.Loader.Noop.Assembly_test.dll" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Methodical/int64/misc/binop_r.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="binop.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="binop.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Generics/Instantiation/delegates/Delegate030.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="Delegate030.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="Delegate030.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/GC/Scenarios/GCSimulator/GCSimulator_350.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <GCStressIncompatible>true</GCStressIncompatible> <CLRTestExecutionArguments>-t 1 -tp 0 -dz 17 -sdz 8517 -dc 10000 -sdc 5000 -lt 3 -f -dp 0.8 -dw 0.0</CLRTestExecutionArguments> <IsGCSimulatorTest>true</IsGCSimulatorTest> <CLRTestProjectToRun>GCSimulator.csproj</CLRTestProjectToRun> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="GCSimulator.cs" /> <Compile Include="lifetimefx.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <GCStressIncompatible>true</GCStressIncompatible> <CLRTestExecutionArguments>-t 1 -tp 0 -dz 17 -sdz 8517 -dc 10000 -sdc 5000 -lt 3 -f -dp 0.8 -dw 0.0</CLRTestExecutionArguments> <IsGCSimulatorTest>true</IsGCSimulatorTest> <CLRTestProjectToRun>GCSimulator.csproj</CLRTestProjectToRun> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="GCSimulator.cs" /> <Compile Include="lifetimefx.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/SIMD/StoreElement_r.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize /> </PropertyGroup> <ItemGroup> <Compile Include="StoreElement.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize /> </PropertyGroup> <ItemGroup> <Compile Include="StoreElement.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/libraries/shims/src/System.Xml.Serialization.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <AssemblyVersion>4.0.0.0</AssemblyVersion> <StrongNameKeyId>ECMA</StrongNameKeyId> </PropertyGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <AssemblyVersion>4.0.0.0</AssemblyVersion> <StrongNameKeyId>ECMA</StrongNameKeyId> </PropertyGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/baseservices/threading/generics/syncdelegate/GThread29.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="thread29.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="thread29.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Regression/JitBlue/GitHub_24114/GitHub_24114.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Methodical/int64/signed/s_ldfld_mul_do.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="s_ldfld_mul.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="s_ldfld_mul.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/CodeGenBringUpTests/JTrueLtFP_do.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="JTrueLtFP.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="JTrueLtFP.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Generics/Conversions/Boxing/box_isinst_unbox.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="box_isinst_unbox.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="box_isinst_unbox.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/libraries/System.Threading.Tasks.Parallel/tests/System.Threading.Tasks.Parallel.Tests.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <IncludeRemoteExecutor>true</IncludeRemoteExecutor> <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> </PropertyGroup> <PropertyGroup> <StartupObject /> </PropertyGroup> <ItemGroup> <Compile Include="$(CommonTestPath)System\Diagnostics\Tracing\TestEventListener.cs" Link="Common\System\Diagnostics\Tracing\TestEventListener.cs" /> <Compile Include="BreakTests.cs" /> <Compile Include="EtwTests.cs" /> <Compile Include="ParallelFor.cs" /> <Compile Include="ParallelForBoundary.cs" /> <Compile Include="ParallelForeachPartitioner.cs" /> <Compile Include="ParallelForEachAsyncTests.cs" /> <Compile Include="ParallelForTest.cs" /> <Compile Include="ParallelForTests.cs" /> <Compile Include="ParallelInvokeTest.cs" /> <Compile Include="ParallelLoopResultTests.cs" /> <Compile Include="ParallelStateTest.cs" /> <Compile Include="RangePartitioner1Chunk.cs" /> <Compile Include="RangePartitionerTests.cs" /> <Compile Include="RangePartitionerThreadSafetyTests.cs" /> <Compile Include="RespectParentCancellationTest.cs" /> <Compile Include="XunitAssemblyAttributes.cs" /> <Compile Include="$(CommonTestPath)System\Threading\ThreadPoolHelpers.cs" Link="CommonTest\System\Threading\ThreadPoolHelpers.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <IncludeRemoteExecutor>true</IncludeRemoteExecutor> <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> </PropertyGroup> <PropertyGroup> <StartupObject /> </PropertyGroup> <ItemGroup> <Compile Include="$(CommonTestPath)System\Diagnostics\Tracing\TestEventListener.cs" Link="Common\System\Diagnostics\Tracing\TestEventListener.cs" /> <Compile Include="BreakTests.cs" /> <Compile Include="EtwTests.cs" /> <Compile Include="ParallelFor.cs" /> <Compile Include="ParallelForBoundary.cs" /> <Compile Include="ParallelForeachPartitioner.cs" /> <Compile Include="ParallelForEachAsyncTests.cs" /> <Compile Include="ParallelForTest.cs" /> <Compile Include="ParallelForTests.cs" /> <Compile Include="ParallelInvokeTest.cs" /> <Compile Include="ParallelLoopResultTests.cs" /> <Compile Include="ParallelStateTest.cs" /> <Compile Include="RangePartitioner1Chunk.cs" /> <Compile Include="RangePartitionerTests.cs" /> <Compile Include="RangePartitionerThreadSafetyTests.cs" /> <Compile Include="RespectParentCancellationTest.cs" /> <Compile Include="XunitAssemblyAttributes.cs" /> <Compile Include="$(CommonTestPath)System\Threading\ThreadPoolHelpers.cs" Link="CommonTest\System\Threading\ThreadPoolHelpers.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/HardwareIntrinsics/X86/Avx2/BroadcastVector128ToVector256_r.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <PropertyGroup> <DebugType>Embedded</DebugType> <Optimize /> </PropertyGroup> <ItemGroup> <Compile Include="BroadcastVector128ToVector256.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <PropertyGroup> <DebugType>Embedded</DebugType> <Optimize /> </PropertyGroup> <ItemGroup> <Compile Include="BroadcastVector128ToVector256.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Methodical/Arrays/misc/selfref_ro.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="selfref.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="selfref.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Methodical/AsgOp/i4/i4flat_cs_ro.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="i4flat.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="i4flat.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/jit64/valuetypes/nullable/box-unbox/null/box-unbox-null022.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="box-unbox-null022.cs" /> <Compile Include="..\structdef.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="box-unbox-null022.cs" /> <Compile Include="..\structdef.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd.Arm64/AdvSimd.Arm64_Part6_ro.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <PropertyGroup> <DebugType>Embedded</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="ZipHigh.Vector64.Byte.cs" /> <Compile Include="ZipHigh.Vector64.Int16.cs" /> <Compile Include="ZipHigh.Vector64.Int32.cs" /> <Compile Include="ZipHigh.Vector64.SByte.cs" /> <Compile Include="ZipHigh.Vector64.Single.cs" /> <Compile Include="ZipHigh.Vector64.UInt16.cs" /> <Compile Include="ZipHigh.Vector64.UInt32.cs" /> <Compile Include="ZipHigh.Vector128.Byte.cs" /> <Compile Include="ZipHigh.Vector128.Double.cs" /> <Compile Include="ZipHigh.Vector128.Int16.cs" /> <Compile Include="ZipHigh.Vector128.Int32.cs" /> <Compile Include="ZipHigh.Vector128.Int64.cs" /> <Compile Include="ZipHigh.Vector128.SByte.cs" /> <Compile Include="ZipHigh.Vector128.Single.cs" /> <Compile Include="ZipHigh.Vector128.UInt16.cs" /> <Compile Include="ZipHigh.Vector128.UInt32.cs" /> <Compile Include="ZipHigh.Vector128.UInt64.cs" /> <Compile Include="ZipLow.Vector64.Byte.cs" /> <Compile Include="ZipLow.Vector64.Int16.cs" /> <Compile Include="ZipLow.Vector64.Int32.cs" /> <Compile Include="ZipLow.Vector64.SByte.cs" /> <Compile Include="ZipLow.Vector64.Single.cs" /> <Compile Include="ZipLow.Vector64.UInt16.cs" /> <Compile Include="ZipLow.Vector64.UInt32.cs" /> <Compile Include="ZipLow.Vector128.Byte.cs" /> <Compile Include="ZipLow.Vector128.Double.cs" /> <Compile Include="ZipLow.Vector128.Int16.cs" /> <Compile Include="ZipLow.Vector128.Int32.cs" /> <Compile Include="ZipLow.Vector128.Int64.cs" /> <Compile Include="ZipLow.Vector128.SByte.cs" /> <Compile Include="ZipLow.Vector128.Single.cs" /> <Compile Include="ZipLow.Vector128.UInt16.cs" /> <Compile Include="ZipLow.Vector128.UInt32.cs" /> <Compile Include="ZipLow.Vector128.UInt64.cs" /> <Compile Include="Program.AdvSimd.Arm64_Part6.cs" /> <Compile Include="..\Shared\Helpers.cs" /> <Compile Include="..\Shared\Program.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <PropertyGroup> <DebugType>Embedded</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="ZipHigh.Vector64.Byte.cs" /> <Compile Include="ZipHigh.Vector64.Int16.cs" /> <Compile Include="ZipHigh.Vector64.Int32.cs" /> <Compile Include="ZipHigh.Vector64.SByte.cs" /> <Compile Include="ZipHigh.Vector64.Single.cs" /> <Compile Include="ZipHigh.Vector64.UInt16.cs" /> <Compile Include="ZipHigh.Vector64.UInt32.cs" /> <Compile Include="ZipHigh.Vector128.Byte.cs" /> <Compile Include="ZipHigh.Vector128.Double.cs" /> <Compile Include="ZipHigh.Vector128.Int16.cs" /> <Compile Include="ZipHigh.Vector128.Int32.cs" /> <Compile Include="ZipHigh.Vector128.Int64.cs" /> <Compile Include="ZipHigh.Vector128.SByte.cs" /> <Compile Include="ZipHigh.Vector128.Single.cs" /> <Compile Include="ZipHigh.Vector128.UInt16.cs" /> <Compile Include="ZipHigh.Vector128.UInt32.cs" /> <Compile Include="ZipHigh.Vector128.UInt64.cs" /> <Compile Include="ZipLow.Vector64.Byte.cs" /> <Compile Include="ZipLow.Vector64.Int16.cs" /> <Compile Include="ZipLow.Vector64.Int32.cs" /> <Compile Include="ZipLow.Vector64.SByte.cs" /> <Compile Include="ZipLow.Vector64.Single.cs" /> <Compile Include="ZipLow.Vector64.UInt16.cs" /> <Compile Include="ZipLow.Vector64.UInt32.cs" /> <Compile Include="ZipLow.Vector128.Byte.cs" /> <Compile Include="ZipLow.Vector128.Double.cs" /> <Compile Include="ZipLow.Vector128.Int16.cs" /> <Compile Include="ZipLow.Vector128.Int32.cs" /> <Compile Include="ZipLow.Vector128.Int64.cs" /> <Compile Include="ZipLow.Vector128.SByte.cs" /> <Compile Include="ZipLow.Vector128.Single.cs" /> <Compile Include="ZipLow.Vector128.UInt16.cs" /> <Compile Include="ZipLow.Vector128.UInt32.cs" /> <Compile Include="ZipLow.Vector128.UInt64.cs" /> <Compile Include="Program.AdvSimd.Arm64_Part6.cs" /> <Compile Include="..\Shared\Helpers.cs" /> <Compile Include="..\Shared\Program.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/GC/API/GCHandle/ToFromIntPtr.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. --> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="ToFromIntPtr.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. --> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="ToFromIntPtr.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/CodeGenBringUpTests/FPConvI2F_d.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="FPConvI2F.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="FPConvI2F.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Regression/CLR-x86-JIT/V1-M11-Beta1/b37636/b37636.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Regression/VS-ia64-JIT/V2.0-Beta2/b360587/b360587.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="repro.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="repro.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Directed/shift/uint64_r.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType /> <Optimize /> </PropertyGroup> <ItemGroup> <Compile Include="uint64.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType /> <Optimize /> </PropertyGroup> <ItemGroup> <Compile Include="uint64.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/tests/JIT/Methodical/MDArray/DataTypes/int_cs_r.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="int.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="int.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,042
[wasm] Add support for symbolicating native traces from JS, using a symbols file
- adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
radical
2022-03-02T00:42:29Z
2022-03-05T02:38:26Z
1b3ef865fd71b898848a1a4b53bf062db622efa9
95770c9198df503d16b5aa9880ebc4e634a970e7
[wasm] Add support for symbolicating native traces from JS, using a symbols file. - adds support for symbolicating error, and warning messages - `debug.js.symbols` is loaded from the vfs - This is enabled by default, only for non-aot tests (since we don't strip aot tests) - Works for debugger tests too
./src/libraries/System.Resources.Reader/ref/System.Resources.Reader.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> <Nullable>enable</Nullable> </PropertyGroup> <ItemGroup> <Compile Include="System.Resources.Reader.Forwards.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> <Nullable>enable</Nullable> </PropertyGroup> <ItemGroup> <Compile Include="System.Resources.Reader.Forwards.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" /> </ItemGroup> </Project>
-1