Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ILS 6.1 SOURCE CODE COMPILING FOR .NET LATER THAN 2.0

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Licensing Support
View previous topic :: View next topic  
Author Message
tslewis



Joined: 06 Mar 2013
Posts: 38

PostPosted: Tue May 12, 2015 2:47 am    Post subject: ILS 6.1 SOURCE CODE COMPILING FOR .NET LATER THAN 2.0 Reply with quote

I have added the latest ILS 6.1 source code and project to my solution.

I am compiling this directly and then referencing the compiled DLL as part of my solution.

I am having errors when I set the compile option to any thing other than .NET 2.0.

All my other assemblies that my solution uses are compiled to .NET 4.5

Any ides why this is happening?

This is the error message I get when I run my executable and for the instance ILS 6.1 is compiled to .NET 4.5

1. Solution exception:Inheritance security rules violated while overriding member: 'Infralution.Licensing.Forms.EncryptedLicense.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.


Cheers
Back to top
View user's profile Send private message
tslewis



Joined: 06 Mar 2013
Posts: 38

PostPosted: Tue May 12, 2015 4:25 am    Post subject: Re: ILS 6.1 SOURCE CODE COMPILING FOR .NET LATER THAN 2.0 Reply with quote

tslewis wrote:
I have added the latest ILS 6.1 source code and project to my solution.

I am compiling this directly and then referencing the compiled DLL as part of my solution.

I am having errors when I set the compile option to any thing other than .NET 2.0.

All my other assemblies that my solution uses are compiled to .NET 4.5

Any ides why this is happening?

This is the error message I get when I run my executable and for the instance ILS 6.1 is compiled to .NET 4.5

1. Solution exception:Inheritance security rules violated while overriding member: 'Infralution.Licensing.Forms.EncryptedLicense.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.


Cheers



It appears to be an issue with versions of .NET later than 3.5
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue May 12, 2015 9:51 am    Post subject: Reply with quote

This is quite a complicated issue. What version of Visual Studio are you using?

Is the code VB.NET or C#?

Are you adding the source code to your own project or have you just added the Infralution.Licensing.Forms project to your solution?

Are you getting a compile time warning or only at runtime?

The problem is coming from the fact that Microsoft have changed the security definition for the ISerializable.GetObject method in the framework. See the following link for more information:

http://stackoverflow.com/questions/3055792/inheritance-security-rules-violated-while-overriding-member-securityruleset-le

I am able to replicate a runtime error like you are seeing if I compile the Infralution.Licensing.Forms project using VS2012 with .NET 4.5 framework and reference it from another project. If however I include the source files directly in the application project (as described in the help section "Redistributables and Source Code") then the error does not occur. You can also prevent the error occurring when referencing the library by removing the AllowPartiallyTrustedCallers attribute from the AssemblyInfo file for the Infralution.Licensing.Forms project.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
tslewis



Joined: 06 Mar 2013
Posts: 38

PostPosted: Fri May 15, 2015 9:14 pm    Post subject: Reply with quote

Infralution wrote:
This is quite a complicated issue. What version of Visual Studio are you using?

Is the code VB.NET or C#?

Are you adding the source code to your own project or have you just added the Infralution.Licensing.Forms project to your solution?

Are you getting a compile time warning or only at runtime?

The problem is coming from the fact that Microsoft have changed the security definition for the ISerializable.GetObject method in the framework. See the following link for more information:

http://stackoverflow.com/questions/3055792/inheritance-security-rules-violated-while-overriding-member-securityruleset-le

I am able to replicate a runtime error like you are seeing if I compile the Infralution.Licensing.Forms project using VS2012 with .NET 4.5 framework and reference it from another project. If however I include the source files directly in the application project (as described in the help section "Redistributables and Source Code") then the error does not occur. You can also prevent the error occurring when referencing the library by removing the AllowPartiallyTrustedCallers attribute from the AssemblyInfo file for the Infralution.Licensing.Forms project.


Thank you for excellent feedback.

I have added the project to my own solution. I am obfuscating and had errors before and decided to compile directly from the source code and then reference the compiled DLL. Seems to work now, but could be an obfuscator setting I Changed.

It seems very difficult to maintain by copying source code directly in to my project. I will reread the link you said

It was a run time error, it compiled fine.

I am using VB.NET and VS2013.

Thanks
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Fri May 15, 2015 11:11 pm    Post subject: Reply with quote

If you are not including the source code in your own project it is probably better to just reference the Infralution.Licensing.Forms assembly that we distribute. This is signed with our own unique strong name (not the one we distribute with the source). If you are going to compiled the project yourself and use the resultant assembly then you should create and use a new strong name - since the strong name we distribute with the source code is the same for all customers.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Licensing Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group