Bugzilla – Bug 318907
Using yield produces classes with duplicate field names.
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by eyala@mainsoft.com 2005-09-07 08:48:22 MST ---- When using the new C# 20 keyword yield in an IEnumerable fields with duplicate names are created within the auto-generated yield class if local variables using the same name are defined in several places within the method. It appears that the algorithm simply adds a field for every local variable using the local variable name. If a name is used for a local variable more then once then several fields using the same name will be created. Using the attached program, once compiled into a DLL you can see using ildasm that '<ff>__' has two fields call 'i'. Trying to ilasm the code generated by ildasm will fail. ---- Additional Comments From eyala@mainsoft.com 2005-09-07 08:51:16 MST ---- Created an attachment (id=168473) C# test sample ---- Additional Comments From jankit@novell.com 2005-09-12 00:45:18 MST ---- *** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO75934 *** Imported an attachment (id=168473) This bug was marked DUPLICATE in the database it was moved from. Changing resolution to "MOVED"