Bug 27270 - Add GeneratedCodeAttribute to generated partial classes
Summary: Add GeneratedCodeAttribute to generated partial classes
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.3
Hardware: PC Windows
: High enhancement
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-02-20 15:21 UTC by Matt Setzer
Modified: 2015-06-29 08:05 UTC (History)
8 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Matt Setzer 2015-02-20 15:21:41 UTC
Generated partial classes can trigger FxCop warnings; for example, if you reference an element in a constraint expression but don't otherwise reference that element in your codebehind, you will trigger CA1823, avoid unused private fields.  Generated files should be marked with the GeneratedCode attribute so FxCop can easily be told to ignore those files when doing analysis.
Comment 1 George Cook 2015-04-29 18:58:26 UTC
I'm working around it right now with a bash script that executes whenever I build, and fixes the import statement; but it kind of sucks, especially seeing as the only way I can get Xamarin to run it, is in an external window, so I need to close a terminal window on each build... hmmph
Comment 2 George Cook 2015-04-29 19:07:18 UTC
resolved it - by using  a custom namespace. 

<page:BasePage 
	xmlns="http://xamarin.com/schemas/2014/forms" 
	xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
	xmlns:page="clr-namespace:TwinEvents.Core.App.View ; assembly=TwinEvents" 
	x:Class="TwinEvents.Core.Events.View.EventsPage"
	x:TypeArguments="TwinEvents.Core.Events.View.EventsPageVM"
	Title="{Binding Title}"
	>

please ignore this issue - perhaps it might help others if they find the ticket though :)
Comment 3 George Cook 2015-04-29 19:08:17 UTC
oh.. how very embarrasing. sorry people - comment 1 and 2 were intended for a completely different bug!!

the shame!! sorry sorry!
Comment 4 Stephane Delcroix 2015-05-20 03:21:49 UTC
Marking the type with GeneratedCodeAttribute is incorrect for a partial class: http://blogs.msdn.com/b/codeanalysis/archive/2007/04/27/correct-usage-of-the-compilergeneratedattribute-and-the-generatedcodeattribute.aspx

Generated fields and methods should be attributed instead.
Comment 5 Jason Smith [MSFT] 2015-05-21 05:20:36 UTC
Should be fixed in the next release.