Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
9
Erster Beitrag:
vor 3 Jahren, 5 Monaten
Letzter Beitrag:
vor 2 Jahren, 2 Monaten
Beteiligte Autoren:
Jeff Graham, David Egan, Alexandre Leclerc

Mixed Mode Assembly error in WD

Startbeitrag von Jeff Graham am 13.09.2014 03:06

Greetings,

I have a 64-bit Framework 4.0 C# assembly that works great until I use the WD DoNetDelegate. Then I get the following error:

Error returned by .NET Framework:
Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

After many, many google searches, I only find that you need a .config file with startup parameters. However, adding that with a WD generated EXE file does not seem to use that .config file.

So, I have done everything I can to make sure all references in my c# assembly use framework 4.0 (minimum for the SDK I am using) but still I get the error. When I select the system.dll file for reference from the 4.0 framework, it changes the path to be x86. I have found that if I add a WD .NET reference to System.dll first, it prevents the problem. But why?

Any comments or suggestions would be appreciated

Antworten:

Hi Jeff,

Maybe this post can help you: http://stackoverflow.com/questions/2455654/what-additional-configuration-is-necessary-to-reference-a-net-2-0-mixed-mode

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 15.09.2014 13:09
Hi Alexandre,

There are many such posts and I have the useLegacyV2RuntimeActivationPolicy="true" in both a C# app.config and in the .exe.config file, but WD does not seem to use the .config file. There is no problem with the C test file, just with WD DotNetDelegate command. Thanks for the response.

von Jeff Graham - am 15.09.2014 15:13
Hi Jeff
Did you ever get this sorted?

I have just started getting the same error, I think only in compiles since the latest update to Windev. I am using a 3rd party .Net dll which hasn't changed in years. I've tried various App.Config things but no luck so far. Any pointers would be much appreciated.

Cheers

David

von David Egan - am 06.12.2015 20:53
Hi
Problem solved by removing .Net assembly from project, adding it back in again & recompiling.

It looks like Windev doesn't automatically recompile the little DLL it creates to talk to the .Net assembly, however the date gets changed every time so you wouldn't know it!

David

von David Egan - am 07.12.2015 00:28
Hi David,

Sometimes it does work to remove and add it back. When I remove my Assembly, WD crashes. Then adding it back in can work sometimes, but not always. I have wasted untold hours trying to create a project for PC Soft. However, whatever I send them gets rejected. I even had a project that in one location worked fine and in another it did not. Project compare said there were no differences but WinMerge binary compare showed differences in binary files. I sent all this and they say it is a .NET Framework problem.

However, I think that there is a logic error in DotNetDelegate that checks something erroneously and it sometimes loads their wd200net2_64.dll when it should not. You can have project working and then copy it to another folder and it will no longer work even when you remove and add the assembly again, etc. See one of my support requests below and this PDF:
https://www.dropbox.com/s/h6dxs0e02ug0wi3/Proof%20of%20DotNetDelegate%20problem.pdf?dl=0

Please report your problem to PC Soft, they don't seem to believe me.

Jeff Graham


************* Your request *************
Request Summary (10 words maximum):
Proof that DotNetDelegate has a problem in 64-bit

Project Type:Windows application

Details of the request:
See previous tech support requests: ST/D682344 and ST/D682352

I have found that using DotNetDelegate with the identical .NET assembly will some times work perfectly and then suddenly start getting the following error
Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.
When executing any instruction like
:m_donWDEventHandler = DotNetDelegate(sProcedureName,"WDEventHandler")

Now I have two identical projects where one gets the error and the other does not.
See the attached PDF file with the evidence.

This is a serious deployment issue as I have found no reliable way to correct the problem once it starts. In the example given, I restore a backup after renaming the folder that was getting the error.

This is an urgent problem since WinDev developers in Norway and Australia are due to start using this .NET assembly.

Reproduction protocol:
Requires a Fujitsu palm vein scanner with the current project. However, I have attached the PvsCS.dll

3 attachment(s):
D:\CAC_Biometrics\Proof of DotNetDelegate problem.pdf
D:\CAC_Biometrics\64-bit\WDPvsTest_V20\Exe\PvsCS.dll
D:\CAC_Biometrics\64-bit\WDPvsTest_V20\Exe\PvsCS.pdb

von Jeff Graham - am 07.12.2015 01:02
Thanks Jeff
Geez I don't like the sound of it working in one location & not in another! What a can of worms that would turn out to be.For the moment the recompile seems to have worked but based on what you're saying I won't really know until all users have updated.

I'll report it to PCS & see what happens.

Cheers

David

von David Egan - am 07.12.2015 03:55
Hi David,

The good thing is that the problem seems to only occur when you are doing development on the assembly. I have not had such problems in deployment.

von Jeff Graham - am 07.12.2015 15:06
I have just begun testing with the French V21 which has some improvements for DotNet.

One of my suggestions to allow include/exclude by configuration for .NET assemblies was implemented.This allows 32-bit and 64-bit configurations to have different assemblies.

DotNetDelegate compiling seems to be more robust.

So far I have not had the Mixed Mode Assembly error. I will update this thread if it does.

von Jeff Graham - am 20.12.2015 22:40
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.