AnsweredAssumed Answered

C# .NET  MGCPCBReleaseEnvironmentLib.MGCPCBReleaseEnvServer exception

Question asked by peter_festesen on Nov 30, 2018
Latest reply on Jan 14, 2019 by Patrick.Cashman

Hello folks - I wonder if this is a known issue to you C#/.NET people.

 

I have just gotten started with .NET and C# and stumbled over this issue. The code :

 

using System;

using System.Windows.Forms;

 

 

namespace xPCB_Development

{

    class Program

    {

        static void Main(string[] args)

        {

            try

            {

                MGCPCBReleaseEnvironmentLib.MGCPCBReleaseEnvServer es = new MGCPCBReleaseEnvironmentLib.MGCPCBReleaseEnvServer();

                //es.SetEnvironment(Environment.GetEnvironmentVariable("SDD_VERSION"));

                es.SetEnvironment();

 

 

                Console.WriteLine($"PROG_ID_VER={Environment.GetEnvironmentVariable("PROG_ID_VER")}");

                Console.WriteLine($"es.SDDHOME={es.sddHome}");

                Console.WriteLine($"es.ProgIDVersion={es.ProgIDVersion}");

 

 

                System.Console.WriteLine("<RET> to terminate");

                System.Console.ReadLine();

 

 

            }

 

 

The issue is that in the console, I get es.SDD_HOME=

so it seems that es.sddHome does not return anything

and then I get an exception at the next line

 

Console.WriteLine($"es.ProgIDVersion={es.ProgIDVersion}");

 

System.AccessViolationException

  HResult=0x80004003

  Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

  Source=<Cannot evaluate the exception source>

  StackTrace:

<Cannot evaluate the exception stack trace>

 

Any hints to what is going wrong here ?

Outcomes