-
Notifications
You must be signed in to change notification settings - Fork 697
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
.NET Native causing NullReferenceException in CallerIdentity class #1149
Comments
On second thought, why is this trying to fail? The assertion should pass and have no reason to go through This seems to only have with |
Unable to run this test without crashing due to fluentassertions/fluentassertions#1149
When comparing collections by equivalency, it's trying to find a combination that as equivalent as possible and report that. Because of its recursive nature, it relies on the internal comparison to throw a failure. So we really have two bugs here. |
Apparently when compiling an UWP project with .NET Native `StackFrame.GetMethod` can return `null`. As determination of caller identity is just a nice-to-have and not a need-to-have I think we should wrap it in a `try/catch` instead of throwing exceptions. Related to fluentassertions#1149
This is fixed, right? |
Yes should be. We null check |
@jnyrup This seems to regress in v6.1 lib. The affected PR is CommunityToolkit/WindowsCommunityToolkit#4181 in the Windows Community Toolkit project. This happened when I was trying to upgrade v5.10.x to v6.1 of the The affected build log is here: |
I can't access that build. Would you mind creating a new issue for that with the stacktrace and as much information as possible? |
I can access the build.
It looks like
|
Weird that there's no line numbers anymore. I guess the PDBs are dropped when you compile to .NET Native. Although I wonder why you would run your unit tests like that. |
@michael-hawker @RosarioPulella @XAML-Knight 👆 Do we know something about this? This is regarding the |
If it's coming from our CI then it'd be so it matches the runtime environment that we expect the code to run in. Locally, it should just run in whatever configuration VS is set to. Eh, @azchohfi? |
Regardless, we need a new bug for this specific case. |
@Nirmal4G mind opening a new bug since I think you have all the context here? |
Description
When using certain functions in UWP tests, null reference exceptions occur only when compiling with .NET Native (which is a requirement for the Windows Store).
Complete minimal example reproducing the issue
Complete means the code snippet can be copied into a unit test method in a fresh C# project and run.
Minimal means it is stripped from code not related to reproducing the issue.
E.g.
Expected behavior:
The assertion should pass
Actual behavior:
Message: Test method ... threw exception:
System.NullReferenceException: Object reference not set to an instance of an object.
Test Name: TestReKey
Test FullName: Test.DatabaseEncryptionTest.TestReKey
Test Source: C:\Development\couchbase-lite-net-ee\couchbase-lite-net\src\Couchbase.Lite.Tests.Shared\DatabaseEncryptionTest.cs : line 169
Test Outcome: Failed
Test Duration: 0:00:00.2356786
Result StackTrace:
Stack trace remainder omitted (no more FA frames)
Versions
Fluent Assertions 5.9.0
UWP 6.0.6 with .NET Native Compiler enabled
Additional Information
This is probably due to native frames being passed through instead of C# ones as the result of the native compilation. Debug builds, without .NET Native enabled, work as expected. I recently upgraded from 4.x to 5.9 and I don't remember this happening in 4.x. I've confirmed this happens because each
StackFrame
inStackTrace
returnsnull
fromGetMethod()
. I feel like this methodDetermineCallerIdentity
should be used quite a bit so I'm not sure why it would only fail from certain conditions.The text was updated successfully, but these errors were encountered: