@@ -203,28 +203,22 @@ public override bool Execute(out IList<Exception> thrownExceptions)
203203
204204 using ( var assemblyDefinition = AssemblyDefinition . ReadAssembly ( IOPath . GetFullPath ( Assembly ) , readerParameters ) )
205205 {
206- CustomAttribute xamlProcessingAttr = null ;
207-
208206#if _MAUIXAML_SOURCEGEN_BACKCOMPAT
209207 CustomAttribute xamlcAttr = null ;
210208 if ( assemblyDefinition . HasCustomAttributes &&
211209 ( xamlcAttr =
212210 assemblyDefinition . CustomAttributes . FirstOrDefault (
213211 ca => ca . AttributeType . FullName == "Microsoft.Maui.Controls.Xaml.XamlCompilationAttribute" ) ) != null )
214212 {
215- if ( xamlProcessingAttr == null )
216- {
217- var options = ( XamlCompilationOptions ) xamlcAttr . ConstructorArguments [ 0 ] . Value ;
218- if ( ( options & XamlCompilationOptions . Skip ) == XamlCompilationOptions . Skip )
219- skipassembly = true ;
220- if ( ( options & XamlCompilationOptions . Compile ) == XamlCompilationOptions . Compile )
221- skipassembly = false ;
222- }
213+ var options = ( XamlCompilationOptions ) xamlcAttr . ConstructorArguments [ 0 ] . Value ;
214+ if ( ( options & XamlCompilationOptions . Skip ) == XamlCompilationOptions . Skip )
215+ skipassembly = true ;
216+ if ( ( options & XamlCompilationOptions . Compile ) == XamlCompilationOptions . Compile )
217+ skipassembly = false ;
223218 }
224219
225220 xamlcAttr = null ;
226221#endif
227- xamlProcessingAttr = null ;
228222
229223 foreach ( var module in assemblyDefinition . Modules )
230224 {
@@ -237,19 +231,14 @@ public override bool Execute(out IList<Exception> thrownExceptions)
237231 module . CustomAttributes . FirstOrDefault (
238232 ca => ca . AttributeType . FullName == "Microsoft.Maui.Controls.Xaml.XamlCompilationAttribute" ) ) != null )
239233 {
240- if ( xamlProcessingAttr == null )
241- {
242-
243- var options = ( XamlCompilationOptions ) xamlcAttr . ConstructorArguments [ 0 ] . Value ;
244- if ( ( options & XamlCompilationOptions . Skip ) == XamlCompilationOptions . Skip )
245- skipmodule = true ;
246- if ( ( options & XamlCompilationOptions . Compile ) == XamlCompilationOptions . Compile )
247- skipmodule = false ;
248- }
234+ var options = ( XamlCompilationOptions ) xamlcAttr . ConstructorArguments [ 0 ] . Value ;
235+ if ( ( options & XamlCompilationOptions . Skip ) == XamlCompilationOptions . Skip )
236+ skipmodule = true ;
237+ if ( ( options & XamlCompilationOptions . Compile ) == XamlCompilationOptions . Compile )
238+ skipmodule = false ;
249239 }
250240 xamlcAttr = null ;
251241#endif
252- xamlProcessingAttr = null ;
253242
254243 LoggingHelper . LogMessage ( Low , $ "{ new string ( ' ' , 2 ) } Module: { module . Name } ") ;
255244 var resourcesToPrune = new List < EmbeddedResource > ( ) ;
@@ -280,20 +269,14 @@ public override bool Execute(out IList<Exception> thrownExceptions)
280269 typeDef . CustomAttributes . FirstOrDefault (
281270 ca => ca . AttributeType . FullName == "Microsoft.Maui.Controls.Xaml.XamlCompilationAttribute" ) ) != null )
282271 {
283- if ( xamlProcessingAttr == null )
284- {
285- // XamlCompilationAttribute is obsolete, but we still need to support it
286- // for backwards compatibility
287- var options = ( XamlCompilationOptions ) xamlcAttr . ConstructorArguments [ 0 ] . Value ;
288- if ( ( options & XamlCompilationOptions . Skip ) == XamlCompilationOptions . Skip )
289- skiptype = true ;
290- if ( ( options & XamlCompilationOptions . Compile ) == XamlCompilationOptions . Compile )
291- skiptype = false ;
292- }
272+ var options = ( XamlCompilationOptions ) xamlcAttr . ConstructorArguments [ 0 ] . Value ;
273+ if ( ( options & XamlCompilationOptions . Skip ) == XamlCompilationOptions . Skip )
274+ skiptype = true ;
275+ if ( ( options & XamlCompilationOptions . Compile ) == XamlCompilationOptions . Compile )
276+ skiptype = false ;
293277 }
294278 xamlcAttr = null ;
295279#endif
296- xamlProcessingAttr = null ;
297280
298281 if ( Type != null )
299282 skiptype = ! ( Type == classname ) ;
0 commit comments