Bug 7574 - Generic sharing broken for .NET generated async code
Summary: Generic sharing broken for .NET generated async code
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: unspecified
Hardware: PC Mac OS
: --- major
Target Milestone: ---
Assignee: Bugzilla
: 7463 ()
Depends on:
Blocks: 7463
  Show dependency tree
Reported: 2012-10-01 14:36 UTC by Marek Safar
Modified: 2017-08-28 15:04 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

test file (10.55 KB, application/octet-stream)
2012-10-01 14:36 UTC, Marek Safar

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Marek Safar 2012-10-01 14:36:22 UTC
Created attachment 2664 [details]
test file

Compile attached sample

mono test-996.exe 
AsyncWithAwait 0
mono -O=-gshared test-996.exe 
AsyncWithAwait 32

I tried to reproduce it with C# alone but cannot, so it looks like it's somehow related to 2 struct fields not being initialised.

    .field  private  valuetype [mscorlib]System.Runtime.CompilerServices.TaskAwaiter '<>u__$awaiter1'
    .field  private  object '<>t__stack'
Comment 1 Marek Safar 2012-10-02 03:01:18 UTC
*** Bug 7463 has been marked as a duplicate of this bug. ***
Comment 2 Zoltan Varga 2012-10-02 07:28:56 UTC
The problem here is the layout of the <AsyncWithAwait>d__0`1<T> type used by the non-gshared method is not the same as the
<AsyncWithAwait>d__0`1 type used by the gshared method.
Comment 3 Rodrigo Kumpera 2012-10-29 11:39:06 UTC
Working on it.
Comment 4 Rodrigo Kumpera 2012-10-29 17:19:45 UTC
Fixed on trunk. 2a899eb83cb8b4888184aa60469cc4835795b688