microsoft / InventorySample

Sample UWP application for LOB scenarios
MIT License
591 stars 199 forks source link

Compilation errors in CustomerDetails.g.cs caused by x:Bind #42

Closed hansmbakker closed 5 years ago

hansmbakker commented 6 years ago

I can't build the project using Visual Studio 2017 15.9 Preview 3 & SDK 17763.

The errors are:

3>------ Build started: Project: Inventory.App, Configuration: Debug x86 ------
3>C:\Users\habakker\Source\Repos\InventorySample\src\Inventory.App\Controls\Buttons\RoundButton.cs(44,29,44,41): warning CS0108: 'RoundButton.CornerRadius' hides inherited member 'Control.CornerRadius'. Use the new keyword if hiding was intended.
3>C:\Users\habakker\Source\Repos\InventorySample\src\Inventory.App\Controls\Buttons\RoundButton.cs(50,51,50,71): warning CS0108: 'RoundButton.CornerRadiusProperty' hides inherited member 'Control.CornerRadiusProperty'. Use the new keyword if hiding was intended.
3>C:\Users\habakker\Source\Repos\InventorySample\src\Inventory.App\obj\x86\Debug\Views\Customer\Details\CustomerDetails.g.cs(924,72,924,87): error CS0029: Cannot implicitly convert type 'string' to 'int?'
3>C:\Users\habakker\Source\Repos\InventorySample\src\Inventory.App\obj\x86\Debug\Views\Customer\Details\CustomerDetails.g.cs(950,71,950,86): error CS0029: Cannot implicitly convert type 'string' to 'decimal?'

The offending parts are:

private void UpdateTwoWay_17_Text()
{
    if (this.initialized)
    {
        if (this.dataRoot != null)
        {
            if (this.dataRoot.EditableItem != null)
            {
                this.dataRoot.EditableItem.TotalChildren = this.obj17.Text; //this line
            }
        }
    }
}

and

private void UpdateTwoWay_19_Text()
{
    if (this.initialized)
    {
        if (this.dataRoot != null)
        {
            if (this.dataRoot.EditableItem != null)
            {
                this.dataRoot.EditableItem.YearlyIncome = this.obj19.Text; //and this line
            }
        }
    }
}

The error seems to be in the x:Bind generated code which seems not process the DataType="Decimal" and DataType="Integer" attribute correctly. This attribute is used at https://github.com/Microsoft/InventorySample/blob/master/src/Inventory.App/Views/Customer/Details/CustomerDetails.xaml#L39,L43

hansmbakker commented 6 years ago

Reported in VS Developer Community at https://developercommunity.visualstudio.com/content/problem/355314/issue-in-xaml-compiler-xbind-generated-code-does-n.html

odyright commented 6 years ago

This happened when I was migrating to Win10 1809... I think it has something to do with that version of windows (1809 bbuild 17763)

odyright commented 6 years ago

@hansmbakker what should i understand with that referenced issue? is there a fix?

hansmbakker commented 6 years ago

No that reference from the PR was just me wanting to make sure that it wasn't the same issue as this issue.

Since I have not had feedback on this issue or the reported issue in the VS Dev Community, I assume this issue is not fixed.

SharmaHS commented 5 years ago

Same error while building the solution in new windows10 build

Felix-Dev commented 5 years ago

Can confirm. Getting the same issue here (Win 10 SDK 17763.132).

Please fix it!

hansmbakker commented 5 years ago

Issue is fixed, this issue can be closed.