dotnet / dotnet/machinelearning-samples
Is this a bug, or is Microsoft ML incompatible with Windows Forms
- Dominant language
- PowerShell
- Stars
- 4.7k
- Forks
- 2.7k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 1
Description
Hello,
trying to integrate machine learnig into a Windows Forms app (even a very simple one that may only predict next value) is not successful. As soon as the ML modules are invoked, an error is thrown:

Details of the error message:
System.DllNotFoundException
HResult=0x80131524
Nachricht = Die DLL "CpuMathNative": Das angegebene Modul wurde nicht gefunden. (Ausnahme von HRESULT: 0x8007007E) kann nicht geladen werden.
Quelle =
Stapelüberwachung:
Obviously, a DLL named CpuMathNative is missing. Does it belong to original Windows code or to .NET Framework (Version???)
Error message 0x8007007E of course has a little strong flavour :-( - Windows Update Error or damaged component store etc.
Therefore I did the usual process:
1. Windows Update Error Processing - Windows can't identify the error
2. All known updates for the moment are successfully installed
3. sfc /scannow and the well known DISM procedure without errors...
Can anybody help? Is there an incompatibility between Microsoft ML and .NET framework (GUI)? For first test, I implemented ML using the model generator within VS.
The test program only tries to predict a new value for the trained model. Here's the code of the ConsumeModel class:
// This file was auto-generated by ML.NET Model Builder.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.ML;
using ModelTrainerML.Model;
namespace ModelTrainerML.Model
{
public class ConsumeModel
{
// For more info on consuming ML.NET models, visit https://aka.ms/model-builder-consume
// Method for consuming model in your app
public static ModelOutput Predict(ModelInput input)
{
// Create new MLContext
MLContext mlContext = new MLContext();
// Load model & create prediction engine
string modelPath = AppDomain.CurrentDomain.BaseDirectory + "MLModel.zip";
ITransformer mlModel = mlContext.Model.Load(modelPath, out var modelInputSchema);
var predEngine = mlContext.Model.CreatePredictionEngine(mlModel);
// Use model to make prediction on input data
ModelOutput result = predEngine.Predict(input);
return result;
}
}
}
If I call the predict method from the ConsoleApp, everything works fine...
Contributor guide
Assessment
This issue has not been assessed yet.