9 Replies Latest reply on Jul 13, 2010 5:46 AM by spilon

    PI ACE 2010 & VS2010 & C#

    Jay5962

      Hey Guys

       

      I thought upgrade my VS to 2010 and run the latest PI ACE and yes thought I'd have a crack at Steve's paper on using C# as well. Well lets say it wasn't a success. Has anyone else had more luck. Below is my error when i atempt to debug the project.

       


      The following breakpoint cannot be set: At ACECalculations
      The specified function does not contain IL code or is not a managed function.

       

      Locating source for 'D:\dev\PIACE\PIACEClassLibraryHost\PIACEHost.vb'. Checksum: MD5 {1c cb 5f d4 dd 0 6c 4c 50 93 2b 3e 31 64 e9 e4}
      The file 'D:\dev\PIACE\PIACEClassLibraryHost\PIACEHost.vb' does not exist.
      Looking in script documents for 'D:\dev\PIACE\PIACEClassLibraryHost\PIACEHost.vb'...
      Looking in the projects for 'D:\dev\PIACE\PIACEClassLibraryHost\PIACEHost.vb'.
      The file was not found in a project.
      Looking in directory 'f:\Program Files\Microsoft Visual Studio 10.0\VC\crt\src\'...
      Looking in directory 'f:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc\'...
      Looking in directory 'f:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\src\atl\'...
      Looking in directory 'f:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\include\'...
      The debug source files settings for the active solution indicate that the debugger will not ask the user to find the file: D:\dev\PIACE\PIACEClassLibraryHost\PIACEHost.vb.
      The debugger could not locate the source file 'D:\dev\PIACE\PIACEClassLibraryHost\PIACEHost.vb'.

        • Re: PI ACE 2010 & VS2010 & C#
          MichaelvdV@Atos

          Just a few thoughts here:

           

          Could it be that it's a x86/x64 thing? (One library referencing another compiled for another platform?)

           

          Have you tried compiling the project to .NET 3.5 (instead of 4.0) ?

          • Re: PI ACE 2010 & VS2010 & C#
            hanyong

            Hi Jason

             

            I tried the procedure in Steve's paper as well... seems like it working for me here. I concur with Michael's suggestion for troubleshooting, or did you manage to resolve this with what Michael has suggested?

              • Re: PI ACE 2010 & VS2010 & C#
                Jay5962

                no such luck, just to confirm its all works perfectly in vb.net.. Its the c# part I'm having problems with.

                  • Re: PI ACE 2010 & VS2010 & C#
                    hanyong

                    Yup, that's what I have done as well. I used x86 version of Visual Studio 2010 and built the C# ACE calculation with .NET framework 3.5 and debug works for me. I did not run a very complicated calculation though, just a simple:

                    OutputTag.Value = InputTag.Value;
                    OutputTag.PutValue();

                     

                    The PutValue() call is just to ensure that the codes are executed and values are written during debugging. Perhaps you can attach the C# project you have so that we can take a look at it?

                      • Re: PI ACE 2010 & VS2010 & C#
                        Jay5962

                        It's very vanilla, as i'm just following the tut

                        using Microsoft.CSharp; 
                        using System;
                        using System.Collections.Generic;
                        using System.Linq;
                        using System.Text;
                        //
                        using OSIsoft.PI.ACE;

                        namespace PIACE.PIACEinCSharp
                        {
                            public class MyACECalc : PIACENetClassModule
                            {
                                PIACEPoint SINUSIOD;
                                PIACEPoint PIACEinCSharp_Out;
                                public override void ACECalculations()
                                {
                                    PIACEinCSharp_Out.Value = (float)SINUSIOD.Value * 1000;
                                    PIACEinCSharp_Out.PutValue();
                                }

                                protected override void InitializePIACEPoints()
                                {
                                    SINUSIOD = GetPIACEPoint("SINUSIOD");
                                    PIACEinCSharp_Out = GetPIACEPoint("PIACEinCSharp_Out");
                                }

                                protected override void ModuleDependentTermination()
                                {
                                    //throw new NotImplementedException();
                                }
                            }
                        }

                          • Re: PI ACE 2010 & VS2010 & C#
                            hanyong

                            Very strange indeed. I'll get a similar message if I step into part of the codes that is part of the PI ACE library and debugger tries to find the source code like PIACEPoint.vb and PIACEHost.vb. But I don't get an error that you have mentioned.

                            Jason Boddy

                            The following breakpoint cannot be set: At ACECalculations
                            The specified function does not contain IL code or is not a managed function.

                             

                            As far as I know, the only thing that I did that is out of the tutorial is to change the target framework from .NET 4.0 to 3.5, because if I used .NET 4.0, PIACEClassLibraryHost would fail to load the assembly.

                    • Re: PI ACE 2010 & VS2010 & C#

                      Jason Boddy

                      Below is my error when i atempt to debug the project.
                      When exactly do you get the error? When you click on Tools > PIACEWizard > Debug or when you try to step in the code? If it's when you are stepping in the code, are you using Step Into (F11) or Step Over (F10)?

                        • Re: PI ACE 2010 & VS2010 & C#
                          Jay5962

                          get the error on both 3.5 & 4 framework and it happens when I debug -> Tools > PIACEWizard > Debug

                            • Re: PI ACE 2010 & VS2010 & C#

                              Jason Boddy

                              get the error on both 3.5 & 4 framework
                              Make sure your project is targeting .NET Framework 3.5, as the assembly won't load with .NET Framework 4.

                               

                              Jason Boddy

                              it happens when I debug -> Tools > PIACEWizard > Debug
                              When is it exactly, that you get the error? Right when you click on the Debug option in the Tools > PIACEWizard menu, or when you start stepping through the code? If it's when you start stepping through the code, do you use Step Over (F10) or Step Into (F11)?

                               

                              Also, can you confirm you are in "Debug" compilation configuration (as opposed to "Release")?