-
Notifications
You must be signed in to change notification settings - Fork 546
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
Can no longer mock DbContext in EF 6.3 Preview. #1020
Comments
Also experiencing this issue |
Looks like 2,234 (74 functional; 16%) of our tests fail without @ajcvickers We should discuss what we want to do here. This was regressed when we moved the build to Arcade. |
@bricelam So am I correct in saying is that Arcade doesn't have a mechanism to strip
Is that correct? |
Correct, we could...
|
@bricelam How feasible is the second option? |
It should be as easy as creating a second csproj--referencing one in the tests and the other in the NuGet package. |
There may also be other ways to re-use the same project and re-build it after running the tests, but two projects would be the simplest solution |
Okay, simple is good. Let's go with that. |
@bricelam in case you haven’t seen it, this PR contains some relevant details, including an “unofficial feature” to generate InternalsVisibleTo in Arcade: dotnet/sdk#3439. |
Thanks everyone for looking into this. Just to confirm, I'm assuming a fix for this was NOT included in the incremental Entity Framework 6.3 Preview 7 that was released yesterday. |
@Pinski Correct. |
Just had the same issue testing 6.3 Preview 8, unfortunately the fix is not in there. Will there be a Preview 9 @ajcvickers ? |
@davidroth Looks like it just missed preview 8. Should be in the daily builds and preview 9. |
Previously I was able to mock my DbContext for testing purposes using Moq like so:
Ever since upgrading to EF 6.3 Preview 6 now this code throws the following exception
I found an old question on StackOverflow where a similar error was occurring during the upgrade from EF 4.2 to EF 4.3. If I understand the post correctly, InternalsVisibleTo attributes were not being properly stripped out causing Moq to fail:
https://stackoverflow.com/a/9266279/311444
Could something similar to this be happening in EF 6.3?
Steps to reproduce
Trying to instantiate an Object of a mocked DbContext throws an exception.
Further technical details
EF version: 6.3.0-preview6-19304-03
Moq version: 4.12.0
Operating system: Windows 10
IDE: Visual Studio 2017 15.9.13 and Visual Studio 2019 16.2.0 Preview 3.0
The text was updated successfully, but these errors were encountered: