Bug 13435 - SIGSEGV instead of CustomAttributeFormatException
Summary: SIGSEGV instead of CustomAttributeFormatException
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Reflection (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Rodrigo Kumpera
URL:
: 13434 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-07-24 07:53 UTC by Marek Safar
Modified: 2013-08-20 19:11 UTC (History)
2 users (show)

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


Attachments
test file (6.00 KB, application/x-msdownload)
2013-07-24 07:53 UTC, Marek Safar
Details
dependency (45.00 KB, application/x-msdownload)
2013-07-24 07:54 UTC, Marek Safar
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 Marek Safar 2013-07-24 07:53:06 UTC
Compile & run

using System;
using System.Reflection;
using System.Collections.Generic;

namespace test5
{
	public class MainClass
	{
		static CustomAttributeData FindAttribute (IList<CustomAttributeData> attributesData, string attrName, string attrNamespace)
		{
			if (attributesData.Count == 0)
				return null;

			foreach (var attr in attributesData) {
				var dt = attr.Constructor.DeclaringType;
				if (dt.Name == attrName && dt.Namespace == attrNamespace)
					return attr;
			}

			return null;
		}

		public static void Main (string[] args)
		{
			var a = Assembly.LoadFile ("test-ps-018.exe");
			var t = a.GetType ("_root.ConstantFields");
			var p = t.GetProperty ("cs9");

			var attributes = CustomAttributeData.GetCustomAttributes (p);

			var data = FindAttribute (attributes, "ConstantFieldAttribute", "PlayScript.Runtime.CompilerServices");
			if (data != null) {
				if (data.ConstructorArguments.Count == 1) {
					return;
				}
			}

			return;

		}
	}
}
Comment 1 Marek Safar 2013-07-24 07:53:54 UTC
Created attachment 4414 [details]
test file
Comment 2 Marek Safar 2013-07-24 07:54:17 UTC
Created attachment 4415 [details]
dependency
Comment 3 Marek Safar 2013-07-24 07:54:41 UTC
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Reflection.CustomAttributeData.ResolveArgumentsInternal (System.Reflection.ConstructorInfo,System.Reflection.Assembly,intptr,uint,object[]&,object[]&) <0xffffffff>
  at System.Reflection.CustomAttributeData.ResolveArguments () <0x0005f>
  at System.Reflection.CustomAttributeData.get_ConstructorArguments () <0x00013>
  at test5.MainClass.Main (string[]) <0x00071>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0xffffffff>
Comment 4 Zoltan Varga 2013-07-27 20:53:39 UTC
We now throw a proper exception when running with --security=validil.
Comment 5 Zoltan Varga 2013-07-27 20:56:17 UTC
*** Bug 13434 has been marked as a duplicate of this bug. ***
Comment 6 Rodrigo Kumpera 2013-08-20 19:11:23 UTC
Fixed in master.