dotnet / infer

Infer.NET is a framework for running Bayesian inference in graphical models
https://dotnet.github.io/infer/
MIT License
1.56k stars 228 forks source link

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

Closed kant2002 closed 8 months ago

kant2002 commented 8 months ago

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)