dotnet / infer

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

Model compilation issue in Blazor WASM #465

Open kant2002 opened 8 months ago

kant2002 commented 8 months ago

I only report this for now, after your fix in #462 I now receve stack trace listed below. I do not this there easy fix, maybe I'm wrong. I definitely try to build from source and play with compilation.

Also maybe it is make sense somehow to document build of the model manually. Maybe serialize results of compilation somehow and provide a way to run model from precompiled state.

Compiling model...done.
Warning, could not add location for assembly: Microsoft.ML.Probabilistic, Version=65534.0.0.0, Culture=neutral, PublicKeyToken=e4813102a62778da
System.ArgumentException: The value cannot be an empty string. (Parameter 'path')
   at System.ArgumentException.ThrowNullOrEmptyException(String argument, String paramName)
   at System.ArgumentException.ThrowIfNullOrEmpty(String argument, String paramName)
   at System.IO.Strategies.FileStreamHelpers.ValidateArguments(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at System.IO.File.OpenRead(String path)
   at Roslyn.Utilities.FileUtilities.OpenFileStream(String path)
   at Microsoft.CodeAnalysis.MetadataReference.CreateFromFile(String path, MetadataReferenceProperties properties, DocumentationProvider documentation)
   at Microsoft.ML.Probabilistic.Compiler.CodeCompiler.CompileWithRoslyn(List`1 filenames, List`1 sources, ICollection`1 referencedAssemblies)
Warning, could not add location for assembly: System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
System.ArgumentException: The value cannot be an empty string. (Parameter 'path')
   at System.ArgumentException.ThrowNullOrEmptyException(String argument, String paramName)
   at System.ArgumentException.ThrowIfNullOrEmpty(String argument, String paramName)
   at System.IO.Strategies.FileStreamHelpers.ValidateArguments(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at System.IO.File.OpenRead(String path)
   at Roslyn.Utilities.FileUtilities.OpenFileStream(String path)
   at Microsoft.CodeAnalysis.MetadataReference.CreateFromFile(String path, MetadataReferenceProperties properties, DocumentationProvider documentation)
   at Microsoft.ML.Probabilistic.Compiler.CodeCompiler.CompileWithRoslyn(List`1 filenames, List`1 sources, ICollection`1 referencedAssemblies)
Warning, could not add location for assembly: netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
.....
System.ArgumentException: The value cannot be an empty string. (Parameter 'path')
   at System.ArgumentException.ThrowNullOrEmptyException(String argument, String paramName)
   at System.ArgumentException.ThrowIfNullOrEmpty(String argument, String paramName)
   at System.IO.Strategies.FileStreamHelpers.ValidateArguments(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at System.IO.File.OpenRead(String path)
   at Roslyn.Utilities.FileUtilities.OpenFileStream(String path)
   at Microsoft.CodeAnalysis.MetadataReference.CreateFromFile(String path, MetadataReferenceProperties properties, DocumentationProvider documentation)
   at Microsoft.ML.Probabilistic.Compiler.CodeCompiler.CompileWithRoslyn(List`1 filenames, List`1 sources, ICollection`1 referencedAssemblies)
Warning, could not add location for assembly: System.Formats.Asn1, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
System.ArgumentException: The value cannot be an empty string. (Parameter 'path')
   at System.ArgumentException.ThrowNullOrEmptyException(String argument, String paramName)
   at System.ArgumentException.ThrowIfNullOrEmpty(String argument, String paramName)
   at System.IO.Strategies.FileStreamHelpers.ValidateArguments(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at System.IO.File.OpenRead(String path)
   at Roslyn.Utilities.FileUtilities.OpenFileStream(String path)
   at Microsoft.CodeAnalysis.MetadataReference.CreateFromFile(String path, MetadataReferenceProperties properties, DocumentationProvider documentation)
   at Microsoft.ML.Probabilistic.Compiler.CodeCompiler.CompileWithRoslyn(List`1 filenames, List`1 sources, ICollection`1 referencedAssemblies)
Compilation failed with 128 error(s)
/GeneratedSource/Model0_EP.cs(4,7): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(5,7): error CS0246: The type or namespace name 'Microsoft' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(6,7): error CS0246: The type or namespace name 'Microsoft' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(7,7): error CS0246: The type or namespace name 'Microsoft' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(23,35): error CS0246: The type or namespace name 'IGeneratedAlgorithm' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(207,16): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(207,16): error CS0246: The type or namespace name 'EventHandler<>' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(207,29): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(207,29): error CS0246: The type or namespace name 'ProgressChangedEventArgs' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(40,10): error CS0518: Predefined type 'System.Int32' is not defined or imported
/GeneratedSource/Model0_EP.cs(55,10): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(55,10): error CS0246: The type or namespace name 'Bernoulli' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(61,11): error CS0518: Predefined type 'System.Void' is not defined or imported
/GeneratedSource/Model0_EP.cs(82,24): error CS0518: Predefined type 'System.Int32' is not defined or imported
/GeneratedSource/Model0_EP.cs(82,48): error CS0518: Predefined type 'System.Boolean' is not defined or imported
/GeneratedSource/Model0_EP.cs(82,11): error CS0518: Predefined type 'System.Void' is not defined or imported
/GeneratedSource/Model0_EP.cs(90,23): error CS0518: Predefined type 'System.Int32' is not defined or imported
/GeneratedSource/Model0_EP.cs(90,10): error CS0518: Predefined type 'System.Void' is not defined or imported
/GeneratedSource/Model0_EP.cs(100,10): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(100,10): error CS0246: The type or namespace name 'Bernoulli' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(107,34): error CS0518: Predefined type 'System.String' is not defined or imported
/GeneratedSource/Model0_EP.cs(107,10): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(116,26): error CS0518: Predefined type 'System.String' is not defined or imported
/GeneratedSource/Model0_EP.cs(116,10): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(135,24): error CS0518: Predefined type 'System.String' is not defined or imported
/GeneratedSource/Model0_EP.cs(144,26): error CS0518: Predefined type 'System.String' is not defined or imported
/GeneratedSource/Model0_EP.cs(144,47): error CS0518: Predefined type 'System.String' is not defined or imported
/GeneratedSource/Model0_EP.cs(144,10): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(157,24): error CS0518: Predefined type 'System.String' is not defined or imported
/GeneratedSource/Model0_EP.cs(157,45): error CS0518: Predefined type 'System.String' is not defined or imported
/GeneratedSource/Model0_EP.cs(162,34): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(162,34): error CS0246: The type or namespace name 'ProgressChangedEventArgs' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(162,11): error CS0518: Predefined type 'System.Void' is not defined or imported
/GeneratedSource/Model0_EP.cs(173,10): error CS0518: Predefined type 'System.Void' is not defined or imported
/GeneratedSource/Model0_EP.cs(183,10): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(183,10): error CS0246: The type or namespace name 'Bernoulli' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(191,32): error CS0518: Predefined type 'System.String' is not defined or imported
/GeneratedSource/Model0_EP.cs(191,53): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(191,10): error CS0518: Predefined type 'System.Void' is not defined or imported
/GeneratedSource/Model0_EP.cs(198,22): error CS0518: Predefined type 'System.Int32' is not defined or imported
/GeneratedSource/Model0_EP.cs(198,10): error CS0518: Predefined type 'System.Void' is not defined or imported
/GeneratedSource/Model0_EP.cs(207,55): error CS0518: Predefined type 'System.Void' is not defined or imported
/GeneratedSource/Model0_EP.cs(207,55): error CS0518: Predefined type 'System.Void' is not defined or imported
/GeneratedSource/Model0_EP.cs(27,10): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(27,10): error CS0246: The type or namespace name 'Bernoulli' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(29,10): error CS0518: Predefined type 'System.Boolean' is not defined or imported
/GeneratedSource/Model0_EP.cs(31,10): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(31,10): error CS0246: The type or namespace name 'Bernoulli' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(33,11): error CS0518: Predefined type 'System.Int32' is not defined or imported
/GeneratedSource/Model0_EP.cs(35,10): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(35,10): error CS0246: The type or namespace name 'Bernoulli' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(63,8): error CS0518: Predefined type 'System.Boolean' is not defined or imported
/GeneratedSource/Model0_EP.cs(66,4): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(66,4): error CS0246: The type or namespace name 'Bernoulli' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(66,28): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(66,28): error CS0103: The name 'Bernoulli' does not exist in the current context
/GeneratedSource/Model0_EP.cs(67,32): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(67,32): error CS0103: The name 'Bernoulli' does not exist in the current context
/GeneratedSource/Model0_EP.cs(68,33): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(68,33): error CS0103: The name 'Bernoulli' does not exist in the current context
/GeneratedSource/Model0_EP.cs(69,4): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(69,4): error CS0246: The type or namespace name 'Bernoulli' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(69,36): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(69,36): error CS0246: The type or namespace name 'Bernoulli' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(70,32): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(70,32): error CS0103: The name 'Bernoulli' does not exist in the current context
/GeneratedSource/Model0_EP.cs(71,4): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(71,4): error CS0246: The type or namespace name 'Bernoulli' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(71,32): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(71,32): error CS0103: The name 'Bernoulli' does not exist in the current context
/GeneratedSource/Model0_EP.cs(73,18): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(73,18): error CS0103: The name 'BooleanAndOp' does not exist in the current context
/GeneratedSource/Model0_EP.cs(75,32): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(75,32): error CS0103: The name 'DerivedVariableOp' does not exist in the current context
/GeneratedSource/Model0_EP.cs(75,77): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(75,77): error CS0246: The type or namespace name 'Bernoulli' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(76,27): error CS0518: Predefined type 'System.Boolean' is not defined or imported
/GeneratedSource/Model0_EP.cs(84,9): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(92,9): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(92,37): error CS0518: Predefined type 'System.Boolean' is not defined or imported
/GeneratedSource/Model0_EP.cs(109,14): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(109,14): error CS0246: The type or namespace name 'ArgumentException' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(109,32): error CS0518: Predefined type 'System.String' is not defined or imported
/GeneratedSource/Model0_EP.cs(118,22): error CS0518: Predefined type 'System.String' is not defined or imported
/GeneratedSource/Model0_EP.cs(118,8): error CS0518: Predefined type 'System.Boolean' is not defined or imported
/GeneratedSource/Model0_EP.cs(118,8): error CS0518: Predefined type 'System.Boolean' is not defined or imported
/GeneratedSource/Model0_EP.cs(119,17): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(121,22): error CS0518: Predefined type 'System.String' is not defined or imported
/GeneratedSource/Model0_EP.cs(121,8): error CS0518: Predefined type 'System.Boolean' is not defined or imported
/GeneratedSource/Model0_EP.cs(121,8): error CS0518: Predefined type 'System.Boolean' is not defined or imported
/GeneratedSource/Model0_EP.cs(122,17): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(124,22): error CS0518: Predefined type 'System.String' is not defined or imported
/GeneratedSource/Model0_EP.cs(124,8): error CS0518: Predefined type 'System.Boolean' is not defined or imported
/GeneratedSource/Model0_EP.cs(124,8): error CS0518: Predefined type 'System.Boolean' is not defined or imported
/GeneratedSource/Model0_EP.cs(125,17): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(127,14): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(127,14): error CS0246: The type or namespace name 'ArgumentException' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(127,32): error CS0518: Predefined type 'System.String' is not defined or imported
/GeneratedSource/Model0_EP.cs(137,11): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(137,11): error CS0103: The name 'Distribution' does not exist in the current context
/GeneratedSource/Model0_EP.cs(137,43): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(146,15): error CS0518: Predefined type 'System.String' is not defined or imported
/GeneratedSource/Model0_EP.cs(146,8): error CS0518: Predefined type 'System.Boolean' is not defined or imported
/GeneratedSource/Model0_EP.cs(146,8): error CS0518: Predefined type 'System.Boolean' is not defined or imported
/GeneratedSource/Model0_EP.cs(147,17): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(149,14): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(149,14): error CS0246: The type or namespace name 'ArgumentException' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(149,35): error CS0518: Predefined type 'System.String' is not defined or imported
/GeneratedSource/Model0_EP.cs(149,88): error CS0518: Predefined type 'System.String' is not defined or imported
/GeneratedSource/Model0_EP.cs(149,115): error CS0518: Predefined type 'System.String' is not defined or imported
/GeneratedSource/Model0_EP.cs(159,11): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(159,11): error CS0103: The name 'Distribution' does not exist in the current context
/GeneratedSource/Model0_EP.cs(159,43): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(166,4): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(166,4): error CS0246: The type or namespace name 'EventHandler<>' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(166,17): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(166,17): error CS0246: The type or namespace name 'ProgressChangedEventArgs' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(167,8): error CS0518: Predefined type 'System.Boolean' is not defined or imported
/GeneratedSource/Model0_EP.cs(167,8): error CS0518: Predefined type 'System.Boolean' is not defined or imported
/GeneratedSource/Model0_EP.cs(175,9): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(175,17): error CS0518: Predefined type 'System.Int32' is not defined or imported
/GeneratedSource/Model0_EP.cs(193,14): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(193,14): error CS0246: The type or namespace name 'ArgumentException' could not be found (are you missing a using directive or an assembly reference?)
/GeneratedSource/Model0_EP.cs(193,32): error CS0518: Predefined type 'System.String' is not defined or imported
/GeneratedSource/Model0_EP.cs(200,9): error CS0518: Predefined type 'System.Object' is not defined or imported
/GeneratedSource/Model0_EP.cs(200,76): error CS0518: Predefined type 'System.Boolean' is not defined or imported
/GeneratedSource/Model0_EP.cs(207,55): error CS0656: Missing compiler required member 'System.Delegate.Combine'
/GeneratedSource/Model0_EP.cs(207,55): error CS0656: Missing compiler required member 'System.Delegate.Remove'
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: Errors found when compiling generated code for: Model0_EP
Microsoft.ML.Probabilistic.Compiler.CompilationFailedException: Errors found when compiling generated code for: Model0_EP
   at Microsoft.ML.Probabilistic.Compiler.ModelCompiler.CompileWithoutParams[IGeneratedAlgorithm](List`1 itds)
   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)
   at InferBlazor.Pages.Counter.IncrementCount() in C:\d\github\InferBlazor\InferBlazor\Pages\Counter.razor:line 35
   at Microsoft.AspNetCore.Components.EventCallbackWorkItem.InvokeAsync[Object](MulticastDelegate delegate, Object arg)
   at Microsoft.AspNetCore.Components.EventCallbackWorkItem.InvokeAsync(Object arg)
   at Microsoft.AspNetCore.Components.ComponentBase.Microsoft.AspNetCore.Components.IHandleEvent.HandleEventAsync(EventCallbackWorkItem callback, Object arg)
   at Microsoft.AspNetCore.Components.EventCallback.InvokeAsync(Object arg)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.DispatchEventAsync(UInt64 eventHandlerId, EventFieldInfo fieldInfo, EventArgs eventArgs, Boolean waitForQuiescence)
kant2002 commented 8 months ago

Also I notice that compiler try to reference following assemblies:

Microsoft.ML.Probabilistic
System.Private.CoreLib
netstandard
System.Runtime    
System.Runtime.InteropServices    
System.IO.MemoryMappedFiles    
System.IO.Pipes    
System.Diagnostics.Process    
System.Security.Cryptography    
System.Memory    
System.Collections    
System.Collections.NonGeneric    
System.Collections.Concurrent    
System.ObjectModel    
System.Collections.Specialized    
System.ComponentModel.TypeConverter    
System.ComponentModel.EventBasedAsync    
System.ComponentModel.Primitives    
System.ComponentModel    
Microsoft.Win32.Primitives    
System.Console    
System.Data.Common    
System.Diagnostics.TraceSource    
System.Diagnostics.Contracts    
System.Diagnostics.TextWriterTraceListener    
System.Diagnostics.FileVersionInfo    
System.Diagnostics.StackTrace    
System.Diagnostics.Tracing    
System.Drawing.Primitives    
System.Linq.Expressions    
System.IO.Compression.Brotli
System.IO.Compression
System.IO.Compression.ZipFile
System.IO.FileSystem.DriveInfo    
System.IO.FileSystem.Watcher    
System.IO.IsolatedStorage    
System.Linq    
System.Linq.Queryable    
System.Linq.Parallel    
System.Threading.Thread    
System.Net.Requests    
System.Net.Primitives    
System.Net.HttpListener    
System.Net.ServicePoint    
System.Net.NameResolution    
System.Net.WebClient    
System.Net.Http    
System.Net.WebHeaderCollection    
System.Net.WebProxy    
System.Net.Mail    
System.Net.NetworkInformation    
System.Net.Ping    
System.Net.Security    
System.Net.Sockets    
System.Net.WebSockets.Client    
System.Net.WebSockets    
System.Runtime.Numerics    
System.Numerics.Vectors    
System.Reflection.DispatchProxy    
System.Reflection.Emit    
System.Reflection.Emit.ILGeneration    
System.Reflection.Emit.Lightweight    
System.Reflection.Primitives    
System.Resources.Writer    
System.Runtime.CompilerServices.VisualC    
System.Runtime.Serialization.Primitives    
System.Runtime.Serialization.Xml    
System.Runtime.Serialization.Json    
System.Runtime.Serialization.Formatters    
System.Security.Claims    
System.Text.Encoding.Extensions    
System.Text.RegularExpressions    
System.Threading    
System.Threading.Overlapped    
System.Threading.ThreadPool    
System.Threading.Tasks.Parallel    
System.Transactions.Local    
System.Web.HttpUtility    
System.Xml.ReaderWriter    
System.Xml.XDocument    
System.Xml.XmlSerializer    
System.Xml.XPath.XDocument    
System.Xml.XPath    
System.Private.Xml    
System.Runtime.Loader    
System.Private.Xml.Linq    
System.Private.DataContractSerialization    
System.Runtime.Intrinsics    
System.Reflection.Metadata    
System.Collections.Immutable    
System.Runtime.InteropServices.JavaScript    
System.Diagnostics.DiagnosticSource    
System.Private.Uri    
System.Formats.Asn1    

I think list a bit excessive. Maybe we can teach model compiler to pass less references?

tminka commented 8 months ago

We could easily provide a function that generates the source code and doesn't try to compile it using the C# compiler. When you compile that code, you can use any references you want. Would that solve the problem? Try engine.GetCodeToInfer.