[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bindings
Subject:    Re: [Kde-bindings] [Qyoto] modifying assembly after building with assemblygen
From:       Dimitar Dobrev <dpldobrev () yahoo ! com>
Date:       2013-03-02 10:25:22
Message-ID: 1362219922.81333.YahooMailNeo () web122405 ! mail ! ne1 ! yahoo ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


    

    Yet another hack that blows up in my face. :) I added this because a user and a \
contributor, Steven Boswell, wanted to use Qyoto with a .NET 3.5 project. On the \
other hand, I need the C# 4.0 compiler for default values of parameters (I know they \
can be simulated through overloads, and that's the way it was, but removing them is \
not an option). The problem is that while it's possible to use C# 4.0 with .NET \
2.0/3.5, I could not find a way to make CodeDom do that. That's why I used Mono.Cecil \
to change the run-time - a not very good solution, as it turns out. I'd like to hear \
any suggestions you may have before digging further.  

    Dimitar



________________________________
 From: David Lechner <david@lechnology.com>
To: kde-bindings@kde.org 
Sent: Saturday, March 2, 2013 4:12 AM
Subject: [Kde-bindings] [Qyoto] modifying assembly after building with assemblygen
 
At the end of main.cs in assemblygen we are using Mono.Cecil to modify the assembly \
we just created.

> AssemblyDefinition assemblyDefinition = \
> AssemblyDefinition.ReadAssembly(cr.PathToAssembly); foreach (ModuleDefinition \
> moduleDefinition in assemblyDefinition.Modules) {
> moduleDefinition.Runtime = TargetRuntime.Net_2_0;
> }
> assemblyDefinition.Write(cr.PathToAssembly);


This causes some undesirable results.

1) It invalidates the signature since we are modifying the assembly after it has been \
signed. I think the patch I made to sign the assemblies in mono was actually \
unnecessary and that this is the cause of the assemblies not being properly signed.

2) I makes the debug information inaccessible even if you add the /debug flag to the \
compile options. At least this is a problem with Visual Studio - I haven't tested it \
with monodevelop. So, it is not possible to do step debugging with the assemblies \
created this way.

Is there another way we can accomplish the same thing without actually modifying the \
assembly here? Or at least make it optional?

_______________________________________________
Kde-bindings mailing list
Kde-bindings@kde.org
https://mail.kde.org/mailman/listinfo/kde-bindings


[Attachment #5 (text/html)]

<html><body><div style="color:#000; background-color:#fff; font-family:times new \
roman, new york, times, serif;font-size:12pt"><span class="tab">&nbsp;&nbsp;&nbsp; \
<br></span><div><span class="tab">&nbsp;&nbsp;&nbsp; Yet another hack that blows up \
in my face. :) </span>I added this because a user and a contributor, Steven Boswell, \
wanted to use Qyoto with a .NET 3.5 project. On the other hand, I need the C# 4.0 \
compiler for default values of parameters (I know they can be simulated through \
overloads, and that's the way it was, but removing them is not an option). The \
problem is that while it's possible to use C# 4.0 with .NET 2.0/3.5, I could not find \
a way to make CodeDom do that. That's why I used Mono.Cecil to change the run-time - \
a not very good solution, as it turns out. I'd like to hear any suggestions you may \
have before digging further.<br><span class="tab">&nbsp;&nbsp;&nbsp; \
<br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px;  font-family: \
times new roman,new york,times,serif; background-color: transparent; font-style: \
normal;"><span class="tab">&nbsp;&nbsp;&nbsp; Dimitar</span><span \
class="tab"><br></span></div><div><br></div>  <div style="font-family: times new \
roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new \
roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" \
size="2"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> David \
Lechner &lt;david@lechnology.com&gt;<br> <b><span style="font-weight: \
bold;">To:</span></b> kde-bindings@kde.org <br> <b><span style="font-weight: \
bold;">Sent:</span></b> Saturday, March 2, 2013 4:12 AM<br> <b><span \
style="font-weight: bold;">Subject:</span></b> [Kde-bindings] [Qyoto] modifying \
assembly after building with assemblygen<br> </font> </div> <br> At the end of <a \
target="_blank" href="http://main.cs/">main.cs</a> in assemblygen we are using \
Mono.Cecil to modify the assembly we just created.<br><br>&gt; AssemblyDefinition \
assemblyDefinition = AssemblyDefinition.ReadAssembly(cr.PathToAssembly);<br>&gt; \
foreach (ModuleDefinition moduleDefinition in assemblyDefinition.Modules)<br>&gt; \
{<br>&gt; &nbsp;&nbsp;&nbsp; moduleDefinition.Runtime = \
TargetRuntime.Net_2_0;<br>&gt; }<br>&gt; \
assemblyDefinition.Write(cr.PathToAssembly);<br><br><br>This causes some undesirable \
results.<br><br>1) It invalidates the signature since we are modifying the assembly \
after it has been signed. I think the patch I made to sign the assemblies in mono was \
actually unnecessary and that this is the cause of the assemblies not being properly \
signed.<br><br>2) I makes the debug information inaccessible even if you add the \
/debug flag to the compile options. At least this is a problem with Visual Studio - I \
haven't tested it with  monodevelop. So, it is not possible to do step debugging with \
the assemblies created this way.<br><br>Is there another way we can accomplish the \
same thing without actually modifying the assembly here? Or at least make it \
optional?<br><br>_______________________________________________<br>Kde-bindings \
mailing list<br><a ymailto="mailto:Kde-bindings@kde.org" \
href="mailto:Kde-bindings@kde.org">Kde-bindings@kde.org</a><br><a \
href="https://mail.kde.org/mailman/listinfo/kde-bindings" \
target="_blank">https://mail.kde.org/mailman/listinfo/kde-bindings</a><br><br><br> \
</div> </div>  </div></body></html>



_______________________________________________
Kde-bindings mailing list
Kde-bindings@kde.org
https://mail.kde.org/mailman/listinfo/kde-bindings


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic