diff options
author | Thays Grazia <thaystg@gmail.com> | 2021-06-11 04:34:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-11 04:34:53 +0300 |
commit | 72557181bc30a6162119b17afe57d8520baa1c9a (patch) | |
tree | 66ac7446cb2b795d1f762bc4c728f65cf02b0fb6 /mcs/class | |
parent | c63478198d3f2ae39a6d4922d20bf3ff093dbafb (diff) |
[debugger] Fix assertion when trying to debug an async method in a valuetype (#21100)
* Fix * Assertion at C:\build\output\Unity-Technologies\mono\mono\mini\debugger-engine.c:1657, condition `is_ok (error)' not met, function:set_set_notification_for_wait_completion_flag, Could not execute the method because the containing type 'System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[T_REF]', is not fully instantiated. assembly:<unknown assembly> type:<unknown type> member:(null)
* Adding test case.
* Remove unrelated changes.
* Fix test on interpreter.
Diffstat (limited to 'mcs/class')
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Makefile | 5 | ||||
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Test/dtest-app-opt.cs | 23 | ||||
-rw-r--r-- | mcs/class/Mono.Debugger.Soft/Test/dtest.cs | 20 |
3 files changed, 47 insertions, 1 deletions
diff --git a/mcs/class/Mono.Debugger.Soft/Makefile b/mcs/class/Mono.Debugger.Soft/Makefile index 79938a8fb05..19b601e4689 100644 --- a/mcs/class/Mono.Debugger.Soft/Makefile +++ b/mcs/class/Mono.Debugger.Soft/Makefile @@ -29,7 +29,7 @@ test_output_dir=$(topdir)/class/lib/$(PROFILE)/tests $(test_output_dir): mkdir -p $@ -build-dtest: $(test_output_dir)/dtest-app.exe $(test_output_dir)/dtest-excfilter.exe +build-dtest: $(test_output_dir)/dtest-app.exe $(test_output_dir)/dtest-excfilter.exe $(test_output_dir)/dtest-app-opt.exe $(test_output_dir)/dtest-excfilter.exe: Test/dtest-excfilter.il | $(test_output_dir) $(ILASM) -out:$@ /exe /debug Test/dtest-excfilter.il @@ -37,6 +37,9 @@ $(test_output_dir)/dtest-excfilter.exe: Test/dtest-excfilter.il | $(test_output_ $(test_output_dir)/dtest-app.exe: Test/dtest-app.cs $(TEST_HELPERS_SOURCES) | $(test_output_dir) $(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll -r:$(topdir)/class/lib/$(PROFILE)/System.Core.dll -r:$(topdir)/class/lib/$(PROFILE)/System.dll -r:$(topdir)/class/lib/$(PROFILE)/System.Runtime.CompilerServices.Unsafe.dll -sourcelink:Test/sourcelink.json -out:$@ -unsafe $(PLATFORM_DEBUG_FLAGS) $(DTEST_APP_FLAGS) -optimize- Test/dtest-app.cs $(TEST_HELPERS_SOURCES) +$(test_output_dir)/dtest-app-opt.exe: Test/dtest-app-opt.cs $(TEST_HELPERS_SOURCES) | $(test_output_dir) + $(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll -r:$(topdir)/class/lib/$(PROFILE)/System.Core.dll -r:$(topdir)/class/lib/$(PROFILE)/System.dll -sourcelink:Test/sourcelink.json -out:$@ -unsafe $(PLATFORM_DEBUG_FLAGS) $(DTEST_APP_FLAGS) -optimize+ Test/dtest-app-opt.cs $(TEST_HELPERS_SOURCES) + TEST_HELPERS_SOURCES = \ ../test-helpers/NetworkHelpers.cs \ Test/TypeLoadClass.cs diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest-app-opt.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest-app-opt.cs new file mode 100644 index 00000000000..5dadc85ce04 --- /dev/null +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest-app-opt.cs @@ -0,0 +1,23 @@ +using System; +using System.Runtime.CompilerServices; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; + +public class Tests +{ + public static int Main (String[] args) { + test_async_debug_generics (); + return 1; + } + [MethodImplAttribute (MethodImplOptions.NoInlining)] + public static void test_async_debug_generics () { + ExecuteAsync_Broken<object>().Wait (); + } + + async static Task<T> ExecuteAsync_Broken<T>() + { + await Task.Delay(2); + return default; + } +} diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs index 2139072fe39..8402b668a1b 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs @@ -49,6 +49,7 @@ public class DebuggerTests public static string agent_args = Environment.GetEnvironmentVariable ("DBG_AGENT_ARGS"); public static string dtest_app_path = "dtest-app.exe"; + public static string dtest_app_opt_path = "dtest-app-opt.exe"; public static string dtest_excfilter_path = "dtest-excfilter.exe"; // Not currently used, but can be useful when debugging individual tests. @@ -5211,6 +5212,25 @@ public class DebuggerTests e = step_in_await ("MoveNext", e); } + + [Test] + public void TestAsyncDebugGenericsValueType () { + vm.Detach(); + Start(dtest_app_opt_path); + MethodMirror async_method = entry_point.DeclaringType.GetMethod("test_async_debug_generics"); + Assert.IsNotNull(async_method); + vm.SetBreakpoint(async_method, 0); + vm.Resume(); + var e = GetNextEvent(); + Assert.AreEqual(EventType.Breakpoint, e.EventType); + e = step_in_await("MoveNext", e); + e = step_in_await("MoveNext", e); + e = step_in_await("MoveNext", e); + vm.Exit(0); + vm = null; + } + + [Test] public void InvalidPointer_GetValue () { vm.Detach (); |