c# - g.i.cs files missing, classes no longer contain a definition for InitializeComponent -


i've been developing uwp project in spare time hang of uwp, mvvm , prism. project classic, no use of mvvm , prism, , i've been working 2 project. i've been relying on https://msdn.microsoft.com/en-us/library/gg405484(v=pandp.40).aspx, https://msdn.microsoft.com/en-us/library/gg405494(v=pandp.40).aspx , https://msdn.microsoft.com/en-us/library/ff921098(v=pandp.40).aspx work way through it.

some background: had direct function call mainpage.xaml mainpage.xaml.cs codebehind, during conversion mvvm , separate usercontrol, removed function call later using command binding. after removed that, got error somewhere in gamerouletteview.g.i.cs remnant of removed function call, g.i.cs file assumed still bound. rebuilt project , g.i.cs files apparently got removed.

i added following lines usercontrol view viewmodel gets added:

xmlns:gameroulette="using:gameroulette.designviewmodels" xmlns:prism="using:prism.windows.mvvm"  d:datacontext="{d:designinstance gameroulette:gameroulettedesignviewmodel, isdesigntimecreatable=true}" prism:viewmodellocator.autowireviewmodel="true" 

full code:

<usercontrol     x:class="gameroulette.views.gamerouletteview"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     xmlns:local="using:gameroulette.views"     xmlns:gameroulette="using:gameroulette.designviewmodels"     xmlns:prism="using:prism.windows.mvvm"      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"     mc:ignorable="d"     d:designheight="300"     d:designwidth="400"     d:datacontext="{d:designinstance gameroulette:gameroulettedesignviewmodel, isdesigntimecreatable=true}"     prism:viewmodellocator.autowireviewmodel="true">     <grid background="white">         <button x:name="btnselectgames" content="click here select games"                 horizontalalignment="left" margin="110,50,0,0"                 verticalalignment="top" height="40" width="240"                 click="{binding selectcommand}"/>         <button x:name="btnchoosegame" content=""                 horizontalalignment="left" margin="110,150,0,0"                 verticalalignment="top" width="240" height="40"                 click="{binding choosecommand}" isenabled="true"/>         <progressring horizontalalignment="left" margin="200,100,0,0"                        verticalalignment="top" rendertransformorigin="1.05,1.983"                       height="45" width="45" isactive="true" visibility="{binding }"/>         <image x:name="imgfileicon" horizontalalignment="left"                height="64" margin="110,224,0,0"                verticalalignment="top" width="64" />         <textblock x:name="lblfilename" horizontalalignment="left"                    margin="179,224,0,0" textwrapping="wrap"                    text="" verticalalignment="top" width="171" height="64"/>     </grid> </usercontrol> 

it gave following error:

the name "gameroulettedesignviewmodel" not exist in namespace "using:gameroulette.designviewmodels". 

i rebuilt project, , gave following error each of 3 .xaml files: gamerouletteview, app.xaml andmainpage.xaml:

'gamerouletteview' not contain definition 'initializecomponent' , no extension method 'initializecomponent' accepting first argument of type 'gamerouletteview' found (are missing using directive or assembly reference?) 

also, when first opening project, intellisense errors:

[failure] not find file 'c:\users\username\source\repos\gameroulette\gameroulette\gameroulette\obj\arm\debug\mainpage.g.i.cs'. [failure] not find file 'c:\users\username\source\repos\gameroulette\gameroulette\gameroulette\obj\arm\debug\views\gamerouletteview.g.i.cs'. [failure] not find file 'c:\users\username\source\repos\gameroulette\gameroulette\gameroulette\obj\arm\debug\app.g.i.cs'. 

things i've ruled out:

  1. my namespaces correct;
  2. i've tried https://stackoverflow.com/a/27260580/1770430, didn't work;
  3. i've deleted bin, obj folders , .suo file, didn't fix it;
  4. i've closed , reopened solution, did not fix it.
  5. repair visual studio through add/repair/remove programs window, no result.

i've googled error, can't find haven't tried yet.

i've noticed nuget packages have gone missing , package manager console not recognize nuget anymore. error:

microsoft.netcore.portable.compatibility 1.0.0 provides compile-time reference assembly mscorlib on uap,version=v10.0, there no run-time assembly compatible win10. 

i got feeling these issues related, can't figure out what's wrong it. mentioned above, google doesn't provide assistance, , provide doesn't work.

i'm using visual studio 2015 community edition update 1. project can found @ https://github.com/nzall/gameroulette.

i've struggled issue couple of days, and, @ least in case, i'm pretty sure depended on subtle bug introduced inadvertently in xaml code. or, better, not bug, that's not supported version of xaml platform targeting. in case xaml parser fails, , g.i.cs files (which contain part of pages , app classes generated parser, including initializecomponent method) not generated expected. why believe that?

  1. at first, thought problem visual studio, cleared component cache, deleted folder c:\users{myname}\appdata\local\microsoft\visualstudio\14.0, disinstalled , reinstalled vs scratch. still had error.
  2. when tried build solution, in error windows saw generic 'object reference not set instance of object', if examined build output window, see problem in effect related xaml parser (precisely: xaml internal error wmc9999).
  3. there's not on internet issue, part few request people facing same situation, 2 pages managed found offer solution both linked problem use of (different) unsupported functionality in xaml (code syntactically correct unsupported target platform): see here , here.
  4. i managed rid of errors undoing last changes source control repository. unfortunately, had made lot of change in code, can't exact line of code caused problem in case. takeaway of story every evidence points fact related xaml code. so, if, of course, 1 can't exclude there major, system-wide issue xaml parser, advise other people facing problem first undo last changes , see if problem disappears.

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -