Beispiel #1
0
        public void TestFixedSizeBuffers()
        {
            var    sourceTemplate = @"
unsafe struct S
{{
    fixed int {0}[1];
    fixed int {0}1[1];
}}
";
            int    padding        = GeneratedNames.MakeFixedFieldImplementationName("A").Length - 1;
            string longName       = s_longSymbolName.Substring(padding);
            var    source         = string.Format(sourceTemplate, longName);
            var    comp           = CreateCompilationWithMscorlib(source, options: TestOptions.UnsafeReleaseDll);

            comp.VerifyDiagnostics();
            // CONSIDER: Location would light up if synthesized methods had them.
            comp.VerifyEmitDiagnostics(
                // error CS7013: Name '<longName1>e__FixedBuffer' exceeds the maximum length allowed in metadata.
                Diagnostic(ErrorCode.ERR_MetadataNameTooLong).WithArguments("<" + longName + 1 + ">e__FixedBuffer").WithLocation(1, 1));
        }