Marshal.GetActiveObject in NET 6.0

Solid Edge, Synchronous Technology, Convergent Technology, and Siemens!
User avatar
Jaylin Hochstetler
Posts: 387
Joined: Sat Mar 13, 2021 8:47 pm
Answers: 4
Location: Michigan
x 380
x 355
Contact:

Marshal.GetActiveObject in NET 6.0

Unread post by Jaylin Hochstetler »

I am learning VB.NET and most of the code I look off of use Marshal.GetActiveObject to connect to a running instance of SolidEdge. Marshal.GetActiveObject is not supported in NET 6. It appears the last supported version was NET 4.8 Framework. What do you use instead in NET 6? Or do you simply not use NET 6?
A goal is only a wish until backed by a plan.
User avatar
JSculley
Posts: 643
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 877

Re: Marshal.GetActiveObject in NET 6.0

Unread post by JSculley »

P/Invoke seems to be the recommended method:

https://renenyffenegger.ch/notes/Micros ... tiveObject
User avatar
Jaylin Hochstetler
Posts: 387
Joined: Sat Mar 13, 2021 8:47 pm
Answers: 4
Location: Michigan
x 380
x 355
Contact:

Re: Marshal.GetActiveObject in NET 6.0

Unread post by Jaylin Hochstetler »

I ended up using .Net 4.8 Framework
There is .NET Standard (5.0 - 6.0), .NET Framework and .NET Core. So confusing...
A goal is only a wish until backed by a plan.
User avatar
bnemec
Posts: 1944
Joined: Tue Mar 09, 2021 9:22 am
Answers: 10
Location: Wisconsin USA
x 2542
x 1400

Re: Marshal.GetActiveObject in NET 6.0

Unread post by bnemec »

Jaylin Hochstetler wrote: Fri Jun 03, 2022 11:47 am I ended up using .Net 4.8 Framework
There is .NET Standard (5.0 - 6.0), .NET Framework and .NET Core. So confusing...
Agreed.
Something about Core that do not play will with CAD APIs, I don't remember what it was, barely understood it at the time. The point was keep with .NET Framework 4.x for PDM or CAD add-ins for now. Core is cross platform (more like cross OS) can be complied for Linux, MacOS, Win, Android... It is for the new age of Workstation == Tablet == Smart Phone == Dash HMI in your car == Cloud hosed == who knows. Clearly, there's no need for a cross platform framework in a Project using SW or PDM APIs.

Standard is something else but still with .NET in front of it. I don't really know what exactly it is, it's not really a framework, it's more like a spec?
User avatar
JSculley
Posts: 643
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 877

Re: Marshal.GetActiveObject in NET 6.0

Unread post by JSculley »

bnemec wrote: Fri Jun 03, 2022 12:02 pm Agreed.
Something about Core that do not play will with CAD APIs, I don't remember what it was, barely understood it at the time. The point was keep with .NET Framework 4.x for PDM or CAD add-ins for now. Core is cross platform (more like cross OS) can be complied for Linux, MacOS, Win, Android... It is for the new age of Workstation == Tablet == Smart Phone == Dash HMI in your car == Cloud hosed == who knows. Clearly, there's no need for a cross platform framework in a Project using SW or PDM APIs.

Standard is something else but still with .NET in front of it. I don't really know what exactly it is, it's not really a framework, it's more like a spec?
The .NET Framework is for Windows only. It includes things that are only available on Windows such as COM, which is what many APIs use under the covers to connect your code to their application.

.NET Core works on more platforms, but has less features (e.g. no COM).

.NET Standard is a specification. Think of it is the minimum requirements for something to be called .NET. So, the .NET framework is an implementation of .NET Standard, with a bunch of other stuff (e.g. COM) and .NET Core is an implementation of .NET Standard with a bunch of different other stuff.
KennyG
Posts: 220
Joined: Tue Mar 09, 2021 2:47 pm
Answers: 7
x 44
x 196

Re: Marshal.GetActiveObject in NET 6.0

Unread post by KennyG »

Actually I believe .NET Core was an early version of a cross-platform version of .NET which was called "Core" up to 3.1. It was missing a lot of things that Framework could do so wasn't quite ready to replace Framework on the Windows desktop. .NET 5 & 6 are the next sequential versions of 3.1 Core but have reached parity with Framework and thus why the numbering starts at "5" and why there will be no new feature versions of Framework which has stopped at version 4.8. The intent is that .NET 6 replaces .NET 4.8 Framework and .NET 3.1 Core and is recommended for new projects.

Interesting enough using VB with a .NET 6 project, you can still use the old VB6 code to get the running instance of Solid Edge:
GetObject(, "SolidEdge.Application")

I don't know what the Cons are for using it vs. Marshall though...
Post Reply