3

I've seen a few conflicting answers about this topic so I'm hoping someone can lead to the right one. I'm building an API that uses devdept Eyeshot library. This library requires .net framework 4.8. I would like to use .NET 6 for my API because from what i can tell, Framework does not have great tools when it come to web development.

I've tried two different set-up's for my solution:

.NET 6 API with a .NET 6 class library where i tried to reference the relevant framework library.

.NET 6 API with framework 4.8 class library.

When I call the class i get the error -"Could not load type 'System.Runtime.Remoting.RemotingServices' from assembly 'mscorlib, Version=4.0.0.0'". But when i run it from a framework 4.8 API it works.

So is there and why at all to get this working with a .NET 6 API, no matter how complicated or does the API have to target the same framework?

  • Are you _sure_ there is no .NET6 Version? – Fildor Jan 27 '23 at 12:35
  • @Fildor I have been using it for years and there is no .NET 6 UserControl yet. – Franck Jan 27 '23 at 12:40
  • I am still failing to see how a .NET 6 Web API and .Net Framework 4.8 UI Components are supposed to go together. What kind of Service are you trying to provide? – Fildor Jan 27 '23 at 12:46
  • @Fildor Well he forgot that people dont necessary know that tool. There is no UI control for web in eyeshot. All you can use from the library in a web app will be in back end like declaring the 3d viewer and perform normal operation like insert 3d objects, collision detection, saving/loading, anything you would normally do but you cant show anything unless at the end you render to a bitmap and then show that somewhere in your HTML. – Franck Jan 27 '23 at 12:52
  • I'm trying to build an API that receives a certain type of xml file with XY coordinates, then through feature detection algorithms make it in to a "map" with lines then. And also export the new "map" to a dwg file – Adam Degerman Jan 27 '23 at 12:53
  • @Franck that is exactly what I'm trying to do... – Adam Degerman Jan 27 '23 at 12:54
  • Isn't that also what the eyeshot web service does? – Fildor Jan 27 '23 at 12:55
  • 1
    @Fildor yeah it does the same exact kind of operations as he's trying to do. As a paid customer they also give you the web service source code sample so you can run your own version of it – Franck Jan 27 '23 at 12:56
  • 2
    @AdamDegerman i've been doing web app with .Net Framework 4.0, .net core and .net 6.0 for a while and i don't see the lack of tool. To me they are all the same. You already know the .Net framework eyeshot implementation so i suggest you code that part of the API as a .net framework web api. Nothing prevent you from making the whole front of your API a .NET 6.0 that in the back call a second very tiny web service in .NET Framework that contain the eyeshot code. – Franck Jan 27 '23 at 13:00
  • ^^ If you so choose to role your own version of the wheel. – Fildor Jan 27 '23 at 13:02
  • @Fildor The format of the xml file is not standard. It's and so is the feature detection required. Therefore the API has to be custom made. – Adam Degerman Jan 27 '23 at 13:02
  • Can you _make it_ standard? Then it maybe boils down to a (maybe simpler) XSL Transform? I mean: If you can find a way to take the custom XML and transform it into standard-compliant XML, then you could use standard-tooling "by proxy". Would that be an option? I suggest this, because I imagine that could be easier done than coding the complete tech stack needed. (+Service & Maintainance) – Fildor Jan 27 '23 at 13:03
  • @Fildor Well we are talking of about 50 lines of code here – Franck Jan 27 '23 at 13:05
  • @Franck Oh, ok. Well ... then. – Fildor Jan 27 '23 at 13:06
  • @Fildor The Eyeshot web service can basically only convert formats and calculate areas. The xml files contains thousands of points that need to be run through 4 different filters using 3 different libraries.... – Adam Degerman Jan 27 '23 at 13:11
  • 1
    Ok, I see. It's out. I am starting think, too, that this will result in something "out-of-process". So, One .NET 6 API (if need be) and a .NET Framework Service talking to each other via IPC/RPC. Maybe that's even a good design if you later on need to scale those differently. – Fildor Jan 27 '23 at 13:15
  • @Frank what i found hard with the .net framework api was how to handle/test posting files. I couldn't use swagger, to select files and i spent a day trying to write a unit test with the proper HttpContext. Never got it to work. But I'll guess I'll just keep trying – Adam Degerman Jan 27 '23 at 13:22
  • Starting from Eyeshot 2022.2, the installer contains .net6 libraries as well. – ilCosmico May 13 '23 at 05:06

2 Answers2

4

You are out of luck unless there is an updated version. The remoting services it depend upon has been removed in the .Net core & .Net 5+. So the library will fail to load, at least if the jitter ever reaches any method that uses one of the removed APIs.

If this is a first party or open source library you might consider updating to .Net 5+, and replace the remoting service with some newer IPC technology. If it is third party commercial library you might politely ask them to update their library, it should be in their own interest since most libraries already have transitioned to .net 5+.

If that is not an option, a possible workaround is to run the library in a separate process, and use your favorite IPC/RPC method to communicate with this processes.

JonasH
  • 28,608
  • 2
  • 10
  • 23
  • The library not open source. I'm a student doing a project for a company pays for the library... So i guess I'm out of luck then. I'll have to look in to what IPC/RPC even is before i make a call. Got any suggestions? – Adam Degerman Jan 27 '23 at 12:58
  • @AdamDegerman The idea is to run a server that receives request, do some processesing, and returns the result, there are many libraries for this, for example[gRPC](https://en.wikipedia.org/wiki/GRPC). Ironically, It is possible that the library does something like that to separate the UI from the analysis server, only it uses an outdated method that is no longer supported. – JonasH Jan 27 '23 at 13:33
  • @AdamDegerman I would check if your company pay for support for the library. If so there should be some support contact you could ask. Someone at the company you work for should be responsible for the library and know something about the support procedure. – JonasH Jan 27 '23 at 13:39
  • I guess I'll have to ask. I was hoping to do this without making waves and if they say no I'll just have to dive back in to framework 4.8 – Adam Degerman Jan 27 '23 at 13:56
3

In addition to the other answer (I was just going to post something similar), do note that when you reference a .NET Framework library from a .NET 6.0 app, the entire code will run in the .NET 6.0 runtime. There's no second execution environment created, therefore the .NET Framework library actually executes against the .NET 6.0 runtime library and fails if it requires features that no longer exists there. Many older libraries work fine that way, since the runtime is mostly backwards compatible, with some notable exceptions. 'System.Runtime.Remoting.RemotingServices is one of them.

PMF
  • 14,535
  • 3
  • 23
  • 49