cureos / accord

Machine learning, computer vision, statistics and general scientific computing for .NET
http://code.google.com/p/accord/
Other
12 stars 2 forks source link

System.TypeInitializationException #6

Closed jamesoliverband closed 10 years ago

jamesoliverband commented 10 years ago

Hi,

when I run the following code I get a System.TypeInitializationException

        double[][] values =
        {
            new double[] {0},
            new double[] {1},
            new double[] {2},
            new double[] {3},
            new double[] {4},
            new double[] {5},
            new double[] {6},
            new double[] {7},
            new double[] {8},
            new double[] {9},
            new double[] {10},
            new double[] {11},
            new double[] {12}
        };

                double[] weights =
        {
            1, 3, 5, 4, 3, 5, 10, 17, 12, 6, 3, 1, 0

        };

                // Create a new Gaussian Mixture Model with 2 components
                GaussianMixtureModel gmm = new GaussianMixtureModel(2);

                // Compute the model (estimate)
                gmm.Compute(values, 0.0001);

The Exception says the following: InnerException {System.IO.FileNotFoundException: Could not load file or assembly 'AForge, Version=2.2.5.0, Culture=neutral, PublicKeyToken=c1db6ff4eaa06aeb' or one of its dependencies. The system cannot find the file specified. File name: 'AForge, Version=2.2.5.0, Culture=neutral, PublicKeyToken=c1db6ff4eaa06aeb' at Accord.Math.Tools..cctor()} System.Exception {System.IO.FileNotFoundException} Please Advise me in solving that issue on WindowsPhone.

cureos commented 10 years ago

I'll look into this in more detail as soon as possible. In the mean time, can you confirm/check the following:

1) are you using the latest binaries from the aforge and accord Releases pages? 2) are you referencing the AForge.System.dll assembly from any of the Phone sub-folders?

Regards, Anders

jamesoliverband commented 10 years ago

Hi, yes, I can confirm both.

1) Yes, using the latest binaries from the aforge and accord Releases pages: 2) Yes, I am referencing the AForge.System.dll assembly from any of the Phone sub-Folders

If I can do anything else to help investigating just tell me.

Regards, James

cureos commented 10 years ago

Hi James,

does your application involve for example imaging also? Then you should make sure to include both the AForge.System.Drawing and the WriteableBitmapExWinPhone DLL:s in the Phone sub-folder. (In the latest source code updates I have removed the WriteableBitmapEx dependency, but I haven't had time to update the binaries yet.)

The binaries in the Phone\Any CPU folder should work, regardless of platform, so you might want to try those for greatest consistency.

I have now included your code in a very simple project, referencing the prebuilt DLL:s, and for me the code runs without problem.

Best regards, Anders

jamesoliverband commented 10 years ago

Hi,

I tried it now also in a fresh one Page Project but it still won't work. I included all libraries delivered. I especially checked that I also use the Phone\Any CPU libraries.

But yet I didn't succeed. Any further suggestions you can give me?

Best regards, James

cureos commented 10 years ago

Hi again James,

you are using VS Express, right? If possible, could you install an evaluation version of VS Pro to see if your problem is related to Visual Studio type?

Also, exactly which DLL:s are you referencing? For the above code, it should suffice to reference AForge.Core, AForge.Math, Accord.Core, Accord.Math, Accord.Statistics and Accord.MachineLearning (maybe even less). You could try and reduce the set of referenced DLL:s as much as possible to see if this has any impact on the exception occurring.

Best regards, Anders

jamesoliverband commented 10 years ago

Hi,

It might be a typo but I only have a AForge.System not a AForge.Core and in the release there is no AForge.Core same Story with the Accord.dll vs. Accord.Core which is in the release included.

I use currently: AForge.System.dll, Accord.dll, Accord.Math.dll, Accord.Statistics.dll, Accord.MachineLearning.dll

I will download in the meanwhile the pro Edition to verify if it works with that.

Thanks in the meanwhile, James

cureos commented 10 years ago

Sorry, I forgot to check the names closely enough. It is not denoted AForge.Core.dll, but AForge.dll, and it is located in the aforge\PCL\Any CPU folder. I think you will also need AForge.Math.dll from the same folder.

Try this first, and only if this does not work you should bother installing VS Pro.

Best regards, Anders

jamesoliverband commented 10 years ago

No Problem. I think we come closer to the solution. Unfortunately, there is no AForge.Math.dll in the Phone folder of the release. Could you provide me this dll?

Best Regards, James

jamesoliverband commented 10 years ago

Sorry I overread that the AForge.Math.dll must be from the aforge\PCL\Any CPU Folder. I managed to run this code without Problems. Many thanks for your help!

Best Regards, James