-
Notifications
You must be signed in to change notification settings - Fork 825
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
New connection crashes VS when generating a new EF model from database #1445
Comments
@Ivutar thanks for reporting, but can you please open a new issue for this (even though they may be related)? I'll look at both issues together soon. |
@roji Thank you for responding. Mine crashes both ways. If I do it the first way it crashes on putting in an IP. If I do it the work around as you say I have the option already selected and I click next and it silently closes like Ivutar posted above. I would be happy to do a webex or provide any logs you need. |
@Jasin2069 thanks for testing. I'm pretty convinced (but not 100%) that these are two separate bugs. For the first one (typing in the host makes VS crash with an NRE) I've already reliably reproduced it here so it's a matter of finding the time to work on it. I haven't looked at the other issue yet, if it reproduces as well it shouldn't be too hard. Will try to look at these soon and will maybe publish a 3.2.1.1 VSIX with the fixes. |
@roji Just to update you, I installed VS 2015 to test the same issues. The crash does not happen when typing in the IP. I am able to put in details and test the connection. However clicking next does the same where it will silently crash. |
@kenjiuno, any idea about these issues? I'm not sure what worked before and what didn't, I think you know more about all this than me... |
@Jasin2069 Hi
Let me know the output from the PowerShell script. |
@kenjiuno Here is the output Npgsql from DbProviderFactories.GetFactory: |
@Jasin2069 Thank you for checking it!
Finally we seem to need Npgsql-3.2.1.msi https://github.com/npgsql/npgsql/releases for only VS2015. |
@kenjiuno I have installed that before and just tried it now with the same exact issue. I am using 2017 mostly but 2015 has the same problem. Also I thought that was no needed if you are using the visual studio extention |
@Jasin2069 Thanks for checking again,
Yea, we inject Npgsql ADO.NET data provider into DbProviderFactories at runtime. The above way will help us to emit the following descritpion in <system.data>
<DbProviderFactories>
<add name="Npgsql Data Provider" invariant="Npgsql"
description="Data Provider for PostgreSQL"
type="Npgsql.NpgsqlFactory, Npgsql" />
</DbProviderFactories>
</system.data> (Copied from http://stackoverflow.com/a/19867046) I think this method works in most case, but it may not work on some cases. Now I'm going back to the original problem:
This is right, however Exception is internally thrown inside Visual Studio. In my research it was
In order to catch the actual Exception, we need to attach a Managed Debugger (like Visual Studio) to the target Visual Studio running ADO.NET EDM Wizard. I'll find a way to do this easily. I need some time. |
@kenjiuno, FYI it's possible to debug the VSIX extension by simply running the project:
After doing this, simply hitting F5 will launch a new instance of VS2017 (experimental) with the Npgsql VSIX loaded inside, so you can play around and set breakpoints. When doing this, I caught a NullReferenceException when executing the scenario described in this issue. The problem seems to be that no Site is injected into the NpgsqlConnectionUIControl. When the user types a character into any text field, NpgsqlConnectionUIControl attempts to update the Site with the information and boom. For some reason, when adding a new connection via the Server Explorer, a Site is properly injected, but not when doing it via the EDM Wizard... Any ideas?? |
Ok I'll check this later... |
Is there any thing else you guys would like me to try? |
@Jasin2069 at least from my side it seems like we have what we need - I can easily reproduce the crash. Understanding why Visual Studio doesn't inject the site in this particular scenario is another matter. @kenjiuno I hope you'll be able to understand what's going on... If you need help etc. let me know. |
So not sure what my options are at this point? I have no way to make a model from db atm. |
@Jasin2069, I have been able to reproduce the crash when typing a character in the dialog - this is what this issue is about. However, if the connection is first defined in Server Explorer and then selected in the EDM wizard, the model seems to be generated just fine. Can you please open a different issue for the second problem (silent crash after clicking next), and try to provide very detailed repro instructions (similar to what I wrote at the top of this issue)? |
After creating the Server Explorer connection was able to create the model. But show a warning.
After google the error I install this microsoft fix. https://msdn.microsoft.com/en-us/library/mt695655.aspx Cumulative Servicing Release for Microsoft Visual Studio 2015 Update 2 (KB3151378) But now I cant connect again |
@kenjiuno any success with this? |
Update to Npgsql 3.2.1, everything should work as expected. |
I still have this problem with latest 4.0.3 version and VS 2017 (15.8.6) :( |
Dear Npgsql Team, I have the same problem with VS2017. Thank you for your great tool! |
I also have the same problem with VS2017. I am using:
I created an empty project and tried to create an EF Designer from database. I chose my PostgreSQL connection previously created, and click "Next". After clicking "Next" on this screen, the window silently closes. No errors and no edmx. Thanks! |
Repeat step 10. to 13. everytime new or update Model is needed. |
Having the exact same problem as @williansdejulio in both VS2015 and VS2017, with the same packages and on the same .NET framework version. This has really been blocking me for two days in my current project, any fix known ? @Avantura82 I tried that a few times already, the problem remains no matter how many times I clean up and restart the whole ordeal, and on both versions of VS. |
Hi @roji, any update on this issue ? I have the same problems. Creating a new postgres database in server explorer crashes. Adding a new ADO.Net Entity Data Model also fails with after selecting the database. The workaround provided by Avantura82 doesn't work for me. EntityFramework v6.2.0 Thanks |
I think author thinks that issue resolved since the status is "Closed" ... |
don't know if that helps but it seems i solved it by uninstalling the entity framework visual editor |
I'll try to look at this again, but in the past I haven't gotten this to repro on my machine, and the root cause was always some old version of the extension that was still somehow being used. For all people encountering this, please try to follow the cleanup instructions above, and also to test on a completely new machine to be extra sure. Please post your findings either way. |
@asimdeveloper There is not enough info in your message. What version of VS are you using? What version of Npgsql VSIX? |
If you provide information about how you solved it, you would help other developers to solve their problems too. The problem you see is tracked by #2670. |
I am seeing silent crashes when generating EF model from database as well. VS 2017(15.9.17) I don't know if this is the issue, but I had originally added the NuGet package for EntityFramework.Npgsql v2.2.7, which also added the Npgsql package v2.2.7 to the project before I realized the name change for EF6. I removed those packages then added the packages listed above before installing the VSIX for version 4.1.1.2. I encountered the error listed in #2670 so I uninstalled that VSIX and installed the VSIX for v4.0.10, which solved the error during creation of the database connection, but now I'm receiving this error when generating a model from a database. I have tried creating the connection in Server Explorer first, as well as creating the connection when adding a new ADO.Net Entity Data Model. I also tried creating an empty data model and using the Generate Model from Database option in the context menu of the Model Explorer. Each method attempts to open the wizard, and I can see the radio button for Entity Framework 6.x before the window closes silently. After this happens I notice that the connection in Server Explorer is created, but has a red X as though it's disconnected (clicking refresh or the expand arrow reconnects the database). I have tried the cleanup steps mentioned above, but after uninstalling the NuGet packages and the VSIX I do not see any references to Npgsql in either the machine.config or devenv.exe.config. I have also tried a new ASP.Net Web Application (Web API) project targeting .NET Framework v4.5, all packages updated to latest stable with the exception of Npgsql due to .NetFramework v4.5 limitation, with the same results. CheckNpgsqlStatus output: HostMicrosoft Visual Studio 15.0 Enterprise GetSection system.data/DbProviderFactories
DbProviderFactories.GetFactoryClasses
Npgsql from DbProviderFactories.GetFactoryNpgsql, Version=4.0.10.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7 Npgsql in active project
Npgsql in OutputPath
|
@richmcd note that you're not supposed to see Npgsql in your machines.config or in your GAC - newer versions of the VSIX don't do that anymore (Npgsql is simply part of the VSIX). We're aware that machines that had older versions of the VSIX sometimes need extensive cleanup precisely because those versions affected global Windows state - any chance you can try out on a clean machine? |
Unfortunately no, I only have access to this machine for development. |
I have debugged the issue with the silent crashes (where the wizard closes with the Entity Framework 6.x radio button shown for a short time). The following exception occurs: |
I was having the exact same issue, here my steps to solve it, perhaps it might be useful for some of you.
In my case it is 4.1.1.2
DO NOT UPGRADE NPGSQL That's it, my Entity Data Model Wizard is working well so far, no more crashes. Cheers |
@diordonez thank you |
I got this Error but I'm using Oracle Database with for example:
|
I also got the "The provider did not return a ProviderManifestToken string" but usually nothing shows |
I was also experiencing the disappearing wizard problem when entering the connection information. Uninstalling the vsix extension and reinstalling it seemed to solve the issue. Then, the next step in the wizard had the same problem. I again reinstalled the extension and now everything seems to work fine. |
Still same issue... Aligning nuget and vsix versions doesn't work. Reinstalling vsix and rebuilding project neither. |
Was this ever fixed? have same issue with VS 2019 community... |
Everyone, please note that the VSIX is no longer being maintained, among other things because issues such as the above were very hard to diagnose and fix. |
For me adding this to my web.config seemed to solve the issue.
|
Repro:
If a new data connection is added directly to the Server Explorer (not via "EF Designer from database"), and then selected when adding the EF model, everything seems to work fine. @Jasin2069 it would be great if you could confirm you're seeing the same thing.
I'll try to understand what's going on. In the meantime simply work around the issue by creating your connections in Server Explorer before generating a model.
Migrated from #1427 (comment)
/cc @Jasin2069
The text was updated successfully, but these errors were encountered: