Author Topic: Add-in Error  (Read 6009 times)

Tehila1

  • EA User
  • **
  • Posts: 256
  • Karma: +0/-0
    • View Profile
Add-in Error
« on: July 14, 2014, 01:51:59 am »
I get the following error when I invoke an add-in menu:

"An error occurred while attempting to communicate with an Addin:  

"EA_MenuClick: Mixed mode assembly is  built agains version `v2.0.50727` of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information."

Have you ever encountered such an error? What is the problem?
Thanks.

ZuluTen

  • EA User
  • **
  • Posts: 56
  • Karma: +0/-0
    • View Profile
Re: Add-in Error
« Reply #1 on: July 14, 2014, 04:37:33 am »
I think that you’ve tried to build your Add In with a target of .NET4.0 whereas the InteropEA is intended to work in a .NET Framework 2.0 environment.
Assuming you’re using Visual Studio: if you look at the Project Properties page and then select References you’ll probably see a mixture of 2.n.n.n and 4.x.x.x references.
It is my understanding that all the references need to match the InteropEA which is a version 2.y.y.y
To change this – and again assuming you’re using Visual Studio: If you look at the Project Properties page then look at the Compile Tab and then select Advanced Compiler Settings; at the bottom of the window is a ‘Target Framework’ pull down in which you can select .NET Framework 2.0.
You may then need to add the appropriate references again, but this time you’ll see they’ll all be at version 2.x.x.x
Now when you build your project it should be ok.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Add-in Error
« Reply #2 on: July 14, 2014, 06:09:05 pm »
This just tells you: "You made an error. Good luck in hunting for it. Your Sparx developer team."

Honestly, I hate it. There's nothing one could do to help you except crossing fingers.

q.

Tehila1

  • EA User
  • **
  • Posts: 256
  • Karma: +0/-0
    • View Profile
Re: Add-in Error
« Reply #3 on: July 14, 2014, 06:12:11 pm »
Thanks for the detailed reply.
I've converted the project to .net 2, as suggested, and the addin is running.

However, I cannot debug it now, is it a result of the .net 2? Or are there other triggers that may prevent from debugging?

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: Add-in Error
« Reply #4 on: July 14, 2014, 06:41:18 pm »
Hi,

I think the problem is somewhere deep in understanding the net framework. The concept of manageable and unmanageable code.

It means: There is manageable code (.net code) and unmanageable code inside your assembly (*.dll).

You may use google to search for:
Mixed mode assembly is  built agains version `v2.0.50727`

In my opinion you use a library which isn't compatible with .net 4. It may be enough to add some configuration information to the code.

May be it's enough to compile it at .net 3.5.

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

Tehila1

  • EA User
  • **
  • Posts: 256
  • Karma: +0/-0
    • View Profile
Re: Add-in Error
« Reply #5 on: July 14, 2014, 07:34:27 pm »
I have a working addin built with .net 4 and I can debug it properly.
When I take the same addin and convert it to .net 3.5 I can't debug it.

How can I debug addins which are lower than .net 4?
Thanks.

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: Add-in Error
« Reply #6 on: July 14, 2014, 07:41:20 pm »
Hi,

I use Visual Studio and I have no problems debugging it. The Express version allows debugging for DLLs only for release 2008. I think there is a patch available to make it work with Visual Studio 2010.

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

Tehila1

  • EA User
  • **
  • Posts: 256
  • Karma: +0/-0
    • View Profile
Re: Add-in Error
« Reply #7 on: July 14, 2014, 10:06:13 pm »
Quote
Hi,

I use Visual Studio and I have no problems debugging it. The Express version allows debugging for DLLs only for release 2008. I think there is a patch available to make it work with Visual Studio 2010.

Helmut

I use Visual Studio 2010 professional. Can't debug.
Any ideas?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8085
  • Karma: +118/-20
    • View Profile
Re: Add-in Error
« Reply #8 on: July 21, 2014, 01:23:49 pm »
I think that the problem of not being able to connect with a .Net 4 add-in could be solved by adding a config file.

I expect you would need to add the following to a file called EA.exe.config. If that isn't the case then Interop.EA.dll.config may work.

Code: [Select]
<configuration>
  <startup>
    <supportedRuntime version="v4.0"/>
    <supportedRuntime version="v2.0.50727"/>
  </startup>
</configuration>

Tehila1

  • EA User
  • **
  • Posts: 256
  • Karma: +0/-0
    • View Profile
Re: Add-in Error
« Reply #9 on: July 21, 2014, 05:37:24 pm »
Quote
I think that the problem of not being able to connect with a .Net 4 add-in could be solved by adding a config file.

I expect you would need to add the following to a file called EA.exe.config. If that isn't the case then Interop.EA.dll.config may work.

Code: [Select]
<configuration>
  <startup>

    <supportedRuntime version="v4.0"/>
    <supportedRuntime version="v2.0.50727"/>
  </startup>
</configuration>


Thanks a lot!
The problem is solved using the suggested configuration!