Skip to content

Type passed in must be derived from System.Attribute or System.Attribute #461

@kant2002

Description

@kant2002

I did try to put Infer.net inside Blazor WASM, so I take FirstExample.cs from tutorials. Here that I receve.

System.ArgumentException: Type passed in must be derived from System.Attribute or System.Attribute itself. Microsoft.ML.Probabilistic.Compiler.Attributes.AllTriggersAttribute
   at System.Reflection.CustomAttribute.IsDefined(ICustomAttributeProvider obj, Type attributeType, Boolean inherit)
   at System.Reflection.RuntimeMethodInfo.IsDefined(Type attributeType, Boolean inherit)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.MessageFcnInfo..ctor(MethodInfo method, IReadOnlyCollection`1 parameters, IReadOnlyDictionary`2 factorEdgeOfParameter)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.FactorManager.FactorInfo.GetMessageFcnInfoFromFactor()
   at Microsoft.ML.Probabilistic.Compiler.Transforms.MessageTransform.MethodConverter.Convert(IMethodInvokeExpression imie, IAssignExpression iae, Boolean isAssignment, Boolean resultIsObserved)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.MessageTransform.ConvertMethodInvoke(IMethodInvokeExpression imie)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.ShallowCopyTransform.DoConvertExpression(IExpression expr)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.ShallowCopyTransform.ConvertExpression(IExpression expr)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.ShallowCopyTransform.ConvertAssign(IAssignExpression iae)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.MessageTransform.ConvertAssign(IAssignExpression iae)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.ShallowCopyTransform.DoConvertExpression(IExpression expr)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.ShallowCopyTransform.ConvertExpression(IExpression expr)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.ShallowCopyTransform.ConvertExpressionStatement(IExpressionStatement ies)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.ShallowCopyTransform.DoConvertStatement(IStatement ist)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.ShallowCopyTransform.ConvertStatement(IStatement ist)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.ShallowCopyTransform.ConvertStatements(IList`1 outputs, IEnumerable`1 inputs)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.ShallowCopyTransform.DoConvertMethodBody(IList`1 outputs, IList`1 inputs)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.MessageTransform.DoConvertMethodBody(IList`1 outputs, IList`1 inputs)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.ShallowCopyTransform.DoConvertMethod(IMethodDeclaration md, IMethodDeclaration imd)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.ShallowCopyTransform.ConvertMethod(IMethodDeclaration imd)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.MessageTransform.ConvertMethod(IMethodDeclaration imd)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.ShallowCopyTransform.ConvertMethods(ITypeDeclaration td, ITypeDeclaration itd)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.ShallowCopyTransform.ConvertType(ITypeDeclaration itd)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.ShallowCopyTransform.Transform(ITypeDeclaration itd)
   at Microsoft.ML.Probabilistic.Compiler.Transforms.MessageTransform.Transform(ITypeDeclaration itd)
   at Microsoft.ML.Probabilistic.Compiler.CodeTransformer.TransformToDeclaration(ITypeDeclaration typeDecl)
   at Microsoft.ML.Probabilistic.Compiler.TransformerChain.TransformToDeclaration(ITypeDeclaration itd, AttributeRegistry`2 inputAttributes, Boolean trackTransform, Boolean showProgress, List`1& warnings, Boolean catchExceptions, Boolean treatWarningsAsErrors)
   at Microsoft.ML.Probabilistic.Compiler.ModelCompiler.GetTransformedDeclaration(ITypeDeclaration itd, MethodBase method, AttributeRegistry`2 inputAttributes)
   at Microsoft.ML.Probabilistic.Compiler.ModelCompiler.CompileWithoutParams(ITypeDeclaration itd, MethodBase method, AttributeRegistry`2 inputAttributes)
   at Microsoft.ML.Probabilistic.Models.InferenceEngine.Compile()
   at Microsoft.ML.Probabilistic.Models.InferenceEngine.BuildAndCompile(Boolean inferOnlySpecifiedVars, IEnumerable`1 vars)
   at Microsoft.ML.Probabilistic.Models.InferenceEngine.GetCompiledInferenceAlgorithm(Boolean inferOnlySpecifiedVars, IVariable var)
   at Microsoft.ML.Probabilistic.Models.InferenceEngine.InferAll(Boolean inferOnlySpecifiedVars, IVariable var)
   at Microsoft.ML.Probabilistic.Models.InferenceEngine.Infer(IVariable var)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions