Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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 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.
The .g.cs is generated in the obj folder. This causes the contents to invisible to Visual studio, which causes InitializeComponent to be unrecognized by the editor.
Any controls that are named in the XAML file (e.g. <Label x:Name="Foo" />) causes a private member to be generated in the g.cs file, which can be used to access the control. This is not available to intellisence either.
This behaviour has been confirmed during a xamarin university session with Rene Ruppert.
Are you using Resharper? There is a known issue with Resharper and detected the .g.cs file. If you disable resharper it should work fine.
Please reopen if you are not using resharper, if you are please go chime in here: http://youtrack.jetbrains.com/issue/RSRP-415583 and here http://youtrack.jetbrains.com/issue/RSRP-265402
Disabling Resharper fixes it.
But still: isn't it "Best Practice" to place generated code next to the file that generated it? As far as my experience goes, this is normal behaviour in Visual Studio when using both WPF and Entity Framework. Its nice for the developer to actually be aware of what was generated. Transparency is nice :-)
actually no. The generated code is only supposed to go next to it *if* its code you would consider checking in. Further even if we put it next to it, we wouldn't add it to the csproj file since its generated at compile time from the .xaml file. This is precisely how its done with silverlight or wpf.
All right. That makes sense. Thanks