Open kbrung opened 9 months ago
Hi, can you provide a code sample for reproduction?
Sorry for the late reply. It is the season of pandemics.
I get a compile time error when compiling this:
namespace MethodBoundaryAspectLimit;
using System;
using MethodBoundaryAspect.Fody.Attributes;
[AttributeUsage(AttributeTargets.Method)]
public sealed class RequiresDoubleGreaterThanAttribute : OnMethodBoundaryAspect
{
public double CriteriaValue { get; }
public RequiresDoubleGreaterThanAttribute(double criteriaValue)
{
CriteriaValue = criteriaValue;
}
public override void OnEntry(MethodExecutionArgs arg)
{
ArgumentNullException.ThrowIfNull(arg);
arg.FlowBehavior = FlowBehavior.RethrowException;
var claimValue = 4.9d;
if (claimValue <= CriteriaValue)
{
throw new InvalidOperationException("Claim value not met.");
}
}
}
public class MyService
{
[RequiresDoubleGreaterThan(5)]
public void DoSomething() => Console.WriteLine("Hello world");
}
public static class Program
{
public static void Main(string[] args)
{
var service = new MyService();
service.DoSomething();
}
}
I get a "Not a supported primitve parameter type: Double" exception in the
LoadPrimitiveConstOnStack(MetadataType type, object value)
of theInstructionBlockCreator
when using doubles in my attributes.Is it possible to get the double type supported?