none
Migrating desktop app to .net 4.5 - security model RRS feed

  • Question

  • Problem: I am trying to determine the fastest way to move our app from .net 3.5 SP1 to .net 4.5 (full NOT client profile) to test if promised bugs have been fixed.

    Background: In our current app, we have a number of issues that have allegedly been fixed in the .net 4 branch but were not backported into the 2.0/3.5 line. These issues are related to hardware/driver incompatibilities on hardware that we do not have in house. I would like to be able to give test binaries to one of our customers to determine if they do see a difference. This will help me know if I should even scope the framework upgrade.  

    The catch is that we use a good deal of interop, and the naive way of just changing the project compilation target yields a ton of runtime exceptions related to the change in security policies in .net 4. I've burned a few days now working through some tutorials and chasing the runtime exceptions around, but haven't made any headway. The app has to be run in full trust and I was wondering if there's a quick way that I can build this now, give it to the customer to test it, to see if it's even worth taking the time to going through and properly marking all the assemblies (including all the 3rd party source, etc).

    Wednesday, November 28, 2012 5:22 PM

Answers

  • Hi Joel,

    Thank you for your further clarification.

    About the exception, please try this attribute: http://msdn.microsoft.com/en-us/library/system.security.securitysafecriticalattribute.aspx 

    >>there have been hundreds of calls to change and as I stated before, given all the work involved I want to be sure that there will be return on my investment before "doing this right."

    So far, I would suggest your make another test project for this scenario which just a few the native calls.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, November 30, 2012 6:40 AM
    Moderator

All replies

  • Hi Jdart,

    Welcome to the MSDN Forum.

    Generally, the testing is a very important part in software development. So I am afraid a quick test is not very valuable.

    Anyway, you can open your original project in VS2012 and change the .net framework to 4.5 and rebuild, fix the compiled errors. And then you will get your goal.

    Please note, this application cannot be test in real environment, since it has not been whole test.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, November 29, 2012 10:49 AM
    Moderator
  • Hey Mike, 

    I should clarify. The client has consistent replication steps that are dependent on hardware that they have but we do not. I want to test if they can replicate the issue when built against .net 4.5 like they can when built against .net 3.5 sp1. If the problem still replicates, I know not to invest more time in regression testing .net 4.5 for our product. This is what I meant by a quick test, and I will be sure the customer knows to delete the application afterwards in order to be compliant with our security policy of course. Thanks for double checking me, though.

    I was already able to successfully change the .net framework to 4.5 on each of my projects without much trouble. My problem is all the runtime errors that come from the changess to the security model. "Attempt by security transparent method '***' to call native code through method '**' failed. Methods must be security critical or security safe-critical to call native code."

    I have already tried the app config setting for NetFx40_LegacySecurityPolicy and it still seems to give the same runtime exceptions, though I can imagine I did something wrong. When I've tried to chase the runtime exceptions, there have been hundreds of calls to change and as I stated before, given all the work involved I want to be sure that there will be return on my investment before "doing this right."

    Thanks,

    Joel

    Thursday, November 29, 2012 7:07 PM
  • Hi Joel,

    Thank you for your further clarification.

    About the exception, please try this attribute: http://msdn.microsoft.com/en-us/library/system.security.securitysafecriticalattribute.aspx 

    >>there have been hundreds of calls to change and as I stated before, given all the work involved I want to be sure that there will be return on my investment before "doing this right."

    So far, I would suggest your make another test project for this scenario which just a few the native calls.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, November 30, 2012 6:40 AM
    Moderator
  • Hi Joel,

    Do you have any update?

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, December 6, 2012 6:41 AM
    Moderator