Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaffold-DbContext does not emit warning messages for failed entity generation #7315

Closed
Axioma-ShirokovPN opened this issue Dec 27, 2016 · 9 comments
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@Axioma-ShirokovPN
Copy link

If table contains columns with UDDT, it can't be exported and there is no log information why.

Steps to reproduce

Install Visual Studio 2017 RC1.
Install MSSQL Server Express 2016.
Create schema Users or remove it from code.
In DB create simple UDDT: CREATE TYPE [Users].[UserName] FROM [nvarchar](20) NOT NULL
And create simple table: CREATE TABLE [Users].[Users]( [UserId] [int] IDENTITY(1,1) NOT NULL, [UserName] [Users].[UserName] NOT NULL, CONSTRAINT [PK_Users.Users:UserId] PRIMARY KEY CLUSTERED ( [UserId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [UsersData] ) ON [UsersData]
Next in VS2017RC1 command line:
Scaffold-DbContext "Server=localhost\SQLEXPRESS; Database=SimpleDB; User Id=Test; Password=Test; MultipleActiveResultSets=true;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Data\Models\Users -Schema Users -Force -Verbose
After this, we will receive:

[Table("Users", Schema = "Users")]
    public partial class Users
    {
        public long UserId { get; set; }
    }

Where is column UserName?! And this for all UDDT.

Key -Verbose in command parameters, but nothing output about this. If your table contains all columns with UDDT - you will receive empty log and simple string // Unable to generate entity type for table 'Users.Users'. Please see the warning messages. in Context.cs
It mean - there is no any info\warnings\errors (it mean ok - isn't it?) in command line with -Verbose key, but receive full zero in code.

Further technical details

<PackageReference Include="Microsoft.NETCore.App" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink.Loader" Version="14.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0-preview4-final" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.0.0-msbuild2-final" />
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0-msbuild2-final" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0-msbuild2-final" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild2-final" />
@divega divega added the type-bug label Jan 6, 2017
@divega divega added this to the 2.0.0 milestone Jan 6, 2017
@rowanmiller rowanmiller changed the title Scaffold-DbContext, MSSQL User Defined Data Type is not reverse with clear log Scaffold-DbContext does not emit warning messages for failed entity generation Feb 22, 2017
@lajones
Copy link
Contributor

lajones commented Feb 25, 2017

With build 15.0.0+26222.1.d15rel I no longer see the precise issue above i.e. the generated Users class has a UserName property of type string. However I've confirmed the larger issue that warning messages don't appear when (for any reason) we can't generate the EntityType - I'm continuing to track that down.

@bricelam bricelam self-assigned this Feb 27, 2017
@markti
Copy link

markti commented Feb 27, 2017

I am frustrated by the fact it simply returns "Build failed." with no further information on how to diagnose the issue that caused the failure.

@bricelam
Copy link
Contributor

bricelam commented Feb 28, 2017

@markti If you're hitting that, the compilation errors should be listed in Visual Studio's Error List tool window.

@bricelam bricelam removed their assignment Mar 2, 2017
@bricelam
Copy link
Contributor

bricelam commented Mar 2, 2017

Marking for re-triage. This (not showing log messages during Scaffold-DbContext) is a good candidate for 1.1.2.

@bricelam bricelam removed this from the 2.0.0 milestone Mar 2, 2017
@lajones lajones added this to the 1.1.2 milestone Mar 3, 2017
@lajones
Copy link
Contributor

lajones commented Mar 8, 2017

Checked in with commits e0e38a4, 1d6e10b (in rel/1.1.2) and 8556de6, 7341248 (in dev).

@Eilon
Copy link
Member

Eilon commented Apr 12, 2017

This patch fix is approved. Please follow the normal code review / pull request process and make sure you make the change in the correct branch.

@lajones
Copy link
Contributor

lajones commented Apr 17, 2017

Change is already checked in to rel/1.1.2 (see above) - no further work.

@lajones lajones closed this as completed Apr 17, 2017
@ajcvickers
Copy link
Member

Preview builds of this patch fix should be available on the following feeds:

If you have a chance, please try out these preview builds and let us know if you have any feedback!

@Axioma-ShirokovPN
Copy link
Author

Yes, it works in aspnet-1-1-2-may2017-patch-public
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

7 participants