@@ -25,7 +25,7 @@ protected override void Process ()
2525 if ( config == null )
2626 return ;
2727 foreach ( var asm in config . Assemblies ) {
28- if ( FindResourceDesigner ( asm , isApplication : true , designer : out mainDesigner , designerAttribute : out mainDesignerAttribute ) ) {
28+ if ( FindResourceDesigner ( asm , mainApplication : true , designer : out mainDesigner , designerAttribute : out mainDesignerAttribute ) ) {
2929 mainAssembly = asm ;
3030 break ;
3131 }
@@ -51,7 +51,7 @@ protected override void EndProcess ()
5151 }
5252 }
5353
54- bool FindResourceDesigner ( AssemblyDefinition assembly , bool isApplication , out TypeDefinition designer , out CustomAttribute designerAttribute )
54+ bool FindResourceDesigner ( AssemblyDefinition assembly , bool mainApplication , out TypeDefinition designer , out CustomAttribute designerAttribute )
5555 {
5656 string designerFullName = null ;
5757 designer = null ;
@@ -65,7 +65,7 @@ bool FindResourceDesigner (AssemblyDefinition assembly, bool isApplication, out
6565 {
6666 foreach ( var p in attribute . Properties )
6767 {
68- if ( p . Name == "IsApplication" && ( bool ) p . Argument . Value == ( isApplication ? isApplication : ( bool ) p . Argument . Value ) )
68+ if ( p . Name == "IsApplication" && ( bool ) p . Argument . Value == ( mainApplication ? mainApplication : ( bool ) p . Argument . Value ) )
6969 {
7070 designerFullName = attribute . ConstructorArguments [ 0 ] . Value . ToString ( ) ;
7171 break ;
@@ -131,7 +131,7 @@ void FixBody (MethodBody body, TypeDefinition localDesigner)
131131 var match = opCodeRegex . Match ( line ) ;
132132 if ( match . Success && match . Groups . Count == 5 ) {
133133 string key = match . Groups [ 4 ] . Value . Replace ( designerFullName , string . Empty ) ;
134- if ( designerConstants . ContainsKey ( key ) )
134+ if ( designerConstants . ContainsKey ( key ) && ! instructions . ContainsKey ( i ) )
135135 instructions . Add ( i , designerConstants [ key ] ) ;
136136 }
137137 }
@@ -185,7 +185,7 @@ protected override void ProcessAssembly (AssemblyDefinition assembly)
185185 CustomAttribute designerAttribute ;
186186 if ( assembly != mainAssembly ) {
187187 Context . LogMessage ( $ " { assembly . Name . Name } is not the main assembly. ") ;
188- if ( ! FindResourceDesigner ( assembly , isApplication : false , designer : out localDesigner , designerAttribute : out designerAttribute ) ) {
188+ if ( ! FindResourceDesigner ( assembly , mainApplication : false , designer : out localDesigner , designerAttribute : out designerAttribute ) ) {
189189 Context . LogMessage ( $ " { assembly . Name . Name } does not have a designer file.") ;
190190 return ;
191191 }
0 commit comments