diff --git a/src/Compilers/Core/Portable/CodeGen/BasicBlock.cs b/src/Compilers/Core/Portable/CodeGen/BasicBlock.cs index 4c8ec2cf56298..cd7db3120be57 100644 --- a/src/Compilers/Core/Portable/CodeGen/BasicBlock.cs +++ b/src/Compilers/Core/Portable/CodeGen/BasicBlock.cs @@ -65,7 +65,6 @@ protected BasicBlock() internal BasicBlock(ILBuilder builder) { - Debug.Assert(BitConverter.IsLittleEndian); Initialize(builder); } diff --git a/src/Compilers/Core/Portable/CodeGen/ILBuilder.cs b/src/Compilers/Core/Portable/CodeGen/ILBuilder.cs index 6c07a0e211d7b..c68b2619901fa 100644 --- a/src/Compilers/Core/Portable/CodeGen/ILBuilder.cs +++ b/src/Compilers/Core/Portable/CodeGen/ILBuilder.cs @@ -71,8 +71,6 @@ internal sealed partial class ILBuilder internal ILBuilder(ITokenDeferral module, LocalSlotManager localSlotManager, OptimizationLevel optimizations, bool areLocalsZeroed) { - Debug.Assert(BitConverter.IsLittleEndian); - this.module = module; this.LocalSlotManager = localSlotManager; _emitState = default(EmitState); diff --git a/src/Compilers/Core/Portable/ConstantValue.cs b/src/Compilers/Core/Portable/ConstantValue.cs index baa8f7123df24..502c08fececcb 100644 --- a/src/Compilers/Core/Portable/ConstantValue.cs +++ b/src/Compilers/Core/Portable/ConstantValue.cs @@ -367,8 +367,6 @@ public static ConstantValue CreateSizeOf(SpecialType st) public static ConstantValue Create(object value, ConstantValueTypeDiscriminator discriminator) { - Debug.Assert(BitConverter.IsLittleEndian); - switch (discriminator) { case ConstantValueTypeDiscriminator.Null: return Null; diff --git a/src/Compilers/Test/Core/Assert/ConditionalFactAttribute.cs b/src/Compilers/Test/Core/Assert/ConditionalFactAttribute.cs index 7b86ce9107e7d..a69dfd043dc27 100644 --- a/src/Compilers/Test/Core/Assert/ConditionalFactAttribute.cs +++ b/src/Compilers/Test/Core/Assert/ConditionalFactAttribute.cs @@ -157,8 +157,11 @@ public static class ExecutionConditionUtil public static bool IsLinux => RuntimeInformation.IsOSPlatform(OSPlatform.Linux); public static bool IsDesktop => RuntimeUtilities.IsDesktopRuntime; public static bool IsWindowsDesktop => IsWindows && IsDesktop; + // IsMonoDesktop means https://github.com/mono/mono public static bool IsMonoDesktop => Type.GetType("Mono.Runtime") != null; public static bool IsMono => MonoHelpers.IsRunningOnMono(); + // IsMonoCore means https://github.com/dotnet/runtime/tree/main/src/mono + public static bool IsMonoCore => Type.GetType("Mono.RuntimeStructs") != null; public static bool IsCoreClr => !IsDesktop; public static bool IsCoreClrUnix => IsCoreClr && IsUnix; public static bool IsMonoOrCoreClr => IsMono || IsCoreClr; @@ -332,6 +335,12 @@ public class ClrOnly : ExecutionCondition public override string SkipReason => "Test not supported on Mono"; } + public class NotOnMonoCore : ExecutionCondition + { + public override bool ShouldSkip => MonoHelpers.IsRunningOnMonoCore(); + public override string SkipReason => "Test not supported on Mono Core"; + } + public class CoreClrOnly : ExecutionCondition { public override bool ShouldSkip => !ExecutionConditionUtil.IsCoreClr; diff --git a/src/Compilers/Test/Core/FX/MonoHelpers.cs b/src/Compilers/Test/Core/FX/MonoHelpers.cs index d6c7c29151fe0..bedf46a80b0f9 100644 --- a/src/Compilers/Test/Core/FX/MonoHelpers.cs +++ b/src/Compilers/Test/Core/FX/MonoHelpers.cs @@ -11,5 +11,6 @@ namespace Microsoft.CodeAnalysis.Test.Utilities public static class MonoHelpers { public static bool IsRunningOnMono() => Roslyn.Test.Utilities.ExecutionConditionUtil.IsMonoDesktop; + public static bool IsRunningOnMonoCore() => Roslyn.Test.Utilities.ExecutionConditionUtil.IsMonoCore; } } diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueClosureTests.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueClosureTests.vb index 8c83f670a0451..b07005d502acb 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueClosureTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueClosureTests.vb @@ -2230,7 +2230,7 @@ End Class diff2.VerifyIL("C.F", expectedIL.Replace("<>", "2")) End Sub - + Public Sub Capture_Local() Using test = New EditAndContinueTest() test.AddBaseline( @@ -2351,7 +2351,7 @@ End Class End Using End Sub - + Public Sub Capture_Parameter() Using test = New EditAndContinueTest() test.AddBaseline( @@ -2468,7 +2468,7 @@ End Class End Using End Sub - + Public Sub Capture_This() Using test = New EditAndContinueTest() test.AddBaseline( @@ -2576,7 +2576,7 @@ End Class End Using End Sub - + Public Sub CeaseCapture_Local() Using test = New EditAndContinueTest() test.AddBaseline( @@ -2651,7 +2651,7 @@ End Class End Using End Sub - + Public Sub CeaseCapture_LastLocal() Using test = New EditAndContinueTest() test.AddBaseline( @@ -2825,7 +2825,7 @@ End Class End Using End Sub - + Public Sub CeaseCapture_This() Using test = New EditAndContinueTest() test.AddBaseline( @@ -2940,7 +2940,7 @@ End Class End Using End Sub - + Public Sub AddingAndRemovingClosure() Using test = New EditAndContinueTest() test.AddBaseline( @@ -3065,7 +3065,7 @@ End Class End Using End Sub - + Public Sub ChainClosure() Using test = New EditAndContinueTest() test.AddBaseline( @@ -3235,7 +3235,7 @@ End Class End Using End Sub - + Public Sub UnchainClosure() Using test = New EditAndContinueTest() test.AddBaseline( @@ -3390,7 +3390,7 @@ End Class End Using End Sub - + Public Sub ChangeClosureParent() Using test = New EditAndContinueTest() test.AddBaseline( @@ -3626,7 +3626,7 @@ End Class End Using End Sub - + Public Sub ChangeLambdaParent() Using test = New EditAndContinueTest() test.AddBaseline( @@ -3791,7 +3791,7 @@ End Class ''' The value of the captured variable might be uninitialized in the lambda. ''' We leave it up to the user to set its value as needed. ''' - + Public Sub UninitializedCapture() Using test = New EditAndContinueTest() test.AddBaseline( @@ -3871,8 +3871,7 @@ End Class Verify() End Using End Sub - - + Public Sub CaptureOrdering() Using test = New EditAndContinueTest() test.AddBaseline( diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.vb index 5a32eb6ade51f..4f734333f79fe 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.vb @@ -982,7 +982,7 @@ End Class End Using End Sub - + Public Sub AsyncMethodOverloads() Using New EditAndContinueTest(_logger). AddBaseline( @@ -1099,7 +1099,7 @@ End Class End Using End Sub - + Public Sub UpdateIterator_NoVariables() Using New EditAndContinueTest(). AddBaseline( @@ -1233,7 +1233,7 @@ End Class", End Using End Sub - + Public Sub UpdateAsync_NoVariables() Using New EditAndContinueTest(). AddBaseline( diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.vb index 7fa811e5b6e87..8e3998babc5e9 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.vb @@ -276,7 +276,7 @@ End Class End Using End Sub - + Public Sub ModifyMethod_ParameterModifiers_RefOut() Using New EditAndContinueTest(). AddBaseline( @@ -1353,7 +1353,7 @@ BC37230: Cannot continue since the edit includes a reference to an embedded type End Using End Sub - + Public Sub EventFields() Using New EditAndContinueTest(). AddBaseline( @@ -1418,7 +1418,7 @@ End Class End Using End Sub - + Public Sub Event_Delete() Using New EditAndContinueTest(). @@ -1570,7 +1570,7 @@ End Class End Using End Sub - + Public Sub Event_TypeChange() Using New EditAndContinueTest(). AddBaseline( @@ -2248,7 +2248,7 @@ End Module End Using End Sub - + Public Sub Property_TypeChange() Using New EditAndContinueTest(). @@ -2465,7 +2465,7 @@ End Class End Using End Sub - + Public Sub Property_Delete() Using New EditAndContinueTest(). AddBaseline( @@ -2591,7 +2591,7 @@ End Class End Using End Sub - + Public Sub Property_DeleteGetter() Using New EditAndContinueTest(). AddBaseline( @@ -4635,7 +4635,7 @@ End Class ''' ''' Local slots must be preserved based on signature. ''' - + Public Sub PreserveLocalSlotsImplicitNamedArgXml() Dim source = " Option Explicit Off @@ -5912,7 +5912,7 @@ End Module #End Region - + Public Sub Lambda_Delete() Using test = New EditAndContinueTest() test.AddBaseline( @@ -6030,7 +6030,7 @@ End Class End Using End Sub - + Public Sub Method_Delete_WithLambda() Using test = New EditAndContinueTest() test.AddBaseline( @@ -6255,7 +6255,7 @@ End Class End Using End Sub - + Public Sub Method_Delete_WithLambda_AddedMethod() Using test = New EditAndContinueTest() test.AddBaseline( @@ -6369,7 +6369,7 @@ End Class End Using End Sub - + Public Sub Method_Delete_WithLambda_MultipleGenerations() Dim common = " Imports System @@ -7434,7 +7434,7 @@ End Class", End Using End Sub - + Public Sub PrivateImplDetails_DataFields_Arrays() Using New EditAndContinueTest(). @@ -7534,7 +7534,7 @@ End Class End Using End Sub - + Public Sub PrivateImplDetails_ComputeStringHash() Using New EditAndContinueTest().