Bug 23438 - ECMA-335 Type layout attributes and atomic operations: a generic type shall not have explicit layout - NUnit test cases are attached, written in F#
Summary: ECMA-335 Type layout attributes and atomic operations: a generic type shall n...
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Verifier ()
Version: 3.8.0
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-09-28 08:18 UTC by KaptOc6obnuCac0Bluc+bugzilla.xamarin.com@kp-tech.hu
Modified: 2014-09-28 19:44 UTC (History)
3 users (show)

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


Attachments
example project (2.16 MB, application/zip)
2014-09-28 08:18 UTC, KaptOc6obnuCac0Bluc+bugzilla.xamarin.com@kp-tech.hu
Details


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:
Status:
RESOLVED FIXED

Description KaptOc6obnuCac0Bluc+bugzilla.xamarin.com@kp-tech.hu 2014-09-28 08:18:47 UTC
Created attachment 8220 [details]
example project

According to ECMA-335 specification:

II.10.1.2
Type layout attributes

explicit: The layout of the fields is explicitly provided (§II.10.7). However, a generic type shall not
have explicit layout.

Non-generic types are works correctly on both .NET and Mono. However generic types are works differently when explicit type layout are defined:

1) .NET refuse to load

2) Mono will load and fail to execute "correctly" - if it even possible to have a correct execution in this case:

NUnit-Console version 2.6.3.13283
Copyright (C) 2002-2012 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.

Runtime Environment - 
   OS Version: Unix 3.14.11.31452
  CLR Version: 4.0.30319.17020 ( Mono 4.0 ( 3.8.0 (tarball Thu Sep 11 14:18:12 CEST 2014) ) )

ProcessModel: Default    DomainUsage: Single
Execution Runtime: mono-4.0
.F..F..F.F.F.F...
Tests run: 11, Errors: 0, Failures: 6, Inconclusive: 0, Time: 0.0929338 seconds
  Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0

Errors and Failures:
1) Test Failure : VolatilePaddedReference.Tests.VolatilePaddedReferenceTest+VolatilePaddedReferenceTests.atomicCompareExchangeMutatesValueIfComparandEqualsCurrent()
     Expected: new
Actual: 
  Expected: "new"
  But was:  null

at VolatilePaddedReference.Tests.VolatilePaddedReferenceTest.shouldEqual[String] (System.String x, System.String y) [0x00000] in <filename unknown>:0
at VolatilePaddedReference.Tests.VolatilePaddedReferenceTest+VolatilePaddedReferenceTests.atomicCompareExchangeMutatesValueIfComparandEqualsCurrent () [0x00000] in <filename unknown>:0

2) Test Failure : VolatilePaddedReference.Tests.VolatilePaddedReferenceTest+VolatilePaddedReferenceTests.atomicCompareExchangeReturnsTrueIfComparandEqualsCurrent()
     Expected: True
Actual: False
  Expected: True
  But was:  False

at VolatilePaddedReference.Tests.VolatilePaddedReferenceTest.shouldEqual[Boolean] (Boolean x, Boolean y) [0x00000] in <filename unknown>:0
at VolatilePaddedReference.Tests.VolatilePaddedReferenceTest+VolatilePaddedReferenceTests.atomicCompareExchangeReturnsTrueIfComparandEqualsCurrent () [0x00000] in <filename unknown>:0

3) Test Failure : VolatilePaddedReference.Tests.VolatilePaddedReferenceTest+VolatilePaddedReferenceTests.atomicExchangeReturnsInitialValue()
     Expected: initial
Actual: 
  Expected: "initial"
  But was:  null

at VolatilePaddedReference.Tests.VolatilePaddedReferenceTest.shouldEqual[String] (System.String x, System.String y) [0x00000] in <filename unknown>:0
at VolatilePaddedReference.Tests.VolatilePaddedReferenceTest+VolatilePaddedReferenceTests.atomicExchangeReturnsInitialValue () [0x00000] in <filename unknown>:0

4) Test Failure : VolatilePaddedReference.Tests.VolatilePaddedReferenceTest+VolatilePaddedReferenceTests.readAcquireFenceReturnsInitialValue()
     Expected: initial
Actual: 
  Expected: "initial"
  But was:  null

at VolatilePaddedReference.Tests.VolatilePaddedReferenceTest.shouldEqual[String] (System.String x, System.String y) [0x00000] in <filename unknown>:0
at VolatilePaddedReference.Tests.VolatilePaddedReferenceTest+VolatilePaddedReferenceTests.readAcquireFenceReturnsInitialValue () [0x00000] in <filename unknown>:0

5) Test Failure : VolatilePaddedReference.Tests.VolatilePaddedReferenceTest+VolatilePaddedReferenceTests.readFullFenceReturnsInitialValue()
     Expected: initial
Actual: 
  Expected: "initial"
  But was:  null

at VolatilePaddedReference.Tests.VolatilePaddedReferenceTest.shouldEqual[String] (System.String x, System.String y) [0x00000] in <filename unknown>:0
at VolatilePaddedReference.Tests.VolatilePaddedReferenceTest+VolatilePaddedReferenceTests.readFullFenceReturnsInitialValue () [0x00000] in <filename unknown>:0

6) Test Failure : VolatilePaddedReference.Tests.VolatilePaddedReferenceTest+VolatilePaddedReferenceTests.readUnfencedReturnsInitialValue()
     Expected: initial
Actual: 
  Expected: "initial"
  But was:  null

at VolatilePaddedReference.Tests.VolatilePaddedReferenceTest.shouldEqual[String] (System.String x, System.String y) [0x00000] in <filename unknown>:0
at VolatilePaddedReference.Tests.VolatilePaddedReferenceTest+VolatilePaddedReferenceTests.readUnfencedReturnsInitialValue () [0x00000] in <filename unknown>:0


Steps to reproduce:
1) unzip volatilepaddedreference.zip
2) cd volatilepaddedreference
3) mono --runtime=v4.0 packages/NUnit.Runners.2.6.3/tools/nunit-console.exe  VolatilePaddedReference.Tests/bin/Debug/VolatilePaddedReference.Tests.dll

The test project including source code and debug binaries are also attached, all written in F#. Please note, the reference equality operator may not perfect.

Regards,
Zoltan
Comment 1 Zoltan Varga 2014-09-28 19:44:53 UTC
Fixed in mono master 5d3a42dc0f75473ad3be7c8f6ae61a76e278fdf0.