-
-
Notifications
You must be signed in to change notification settings - Fork 813
System.NotSupportedException : Cannot create boxed ByRef-like values. #829
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
Comments
Hi @wessiyad, thanks for reporting. At first glance, it looks like this is a limitation of |
Indeed, your repro code can be shortened to the following one-liner: _ = Activator.CreateInstance(typeof(ReadOnlySpan<char>)); And I'm sorry to say that there's nothing we can do to work around this runtime / framework limitation. Moq won't be able to create a default return value for your interface method due to that.
|
- expand our text matrix to include a modern (and LTS) TFM - move to VS2022 and the latest 6.0 .NET SDK for `net6.0` support - change how Formatting test assemblies are found - `netcoreapp` is no longer the only relevant folder prefix - react to new `Exception.Message`s in `netcoreapp3.1` - handle different formatting of argument info in `ArgumentException.Message`s - handle slightly greater `decimal` precision in a `JsonReaderException.Message` - react to new `Exception.Message`s and other changes in `net6.0` - handle different `Message` in `InvalidOperationException`s about invalid request URIs - handle `HttpResponseMessage.Content != null` after construction (a test-only change fortunately) - see dotnet/runtime@b48900f which introduced this - handle inability to mock a `Stream` if a writer passes a `ReadOnlySpan<byte>` in `net6.0` - see devlooped/moq#829, devlooped/moq#979, and dotnet/runtime#45152 about the issue - nit: simplify define use now that `NETCOREAPP3_1_OR_GREATER` and so on are available
- expand our text matrix to include a modern (and LTS) TFM - change how Formatting test assemblies are found - `netcoreapp` is no longer the only relevant folder prefix - use the latest .NET 6 SDK - install the 2.1.x runtime in the pipeline - don't require .NET in VS - will use binplaced `msbuild` instead - have `git` ignore the new .msbuild/ folder - react to new `Exception.Message`s in `netcoreapp3.1` - handle different formatting of argument info in `ArgumentException.Message`s - handle slightly greater `decimal` precision in a `JsonReaderException.Message` - react to new `Exception.Message`s and other changes in `net6.0` - handle different `Message` in `InvalidOperationException`s about invalid request URIs - react to other changes in `net6.0` - handle inability to mock a `Stream` if a writer passes a `ReadOnlySpan<byte>` in `net6.0` - see devlooped/moq#829, devlooped/moq#979, and dotnet/runtime#45152 about the issue - skip tests failing due to `HttpResponseMessage` changes - see dotnet/runtime@b48900f which introduced this - nits: - simplify define use now that `NETCOREAPP3_1_OR_GREATER` and so on are available - clean up .gitignore
- expand our text matrix to include a modern (and LTS) TFM - change how Formatting test assemblies are found - `netcoreapp` is no longer the only relevant folder prefix - use the latest .NET 6 SDK - install the 2.1.x runtime in the pipeline - don't require .NET in VS - will use binplaced `msbuild` instead - have `git` ignore the new .msbuild/ folder - react to new `Exception.Message`s in `netcoreapp3.1` - handle different formatting of argument info in `ArgumentException.Message`s - handle slightly greater `decimal` precision in a `JsonReaderException.Message` - react to new `Exception.Message`s and other changes in `net6.0` - handle different `Message` in `InvalidOperationException`s about invalid request URIs - react to other changes in `net6.0` - handle inability to mock a `Stream` if a writer passes a `ReadOnlySpan<byte>` in `net6.0` - see devlooped/moq#829, devlooped/moq#979, and dotnet/runtime#45152 about the issue - skip tests failing due to `HttpResponseMessage` changes - see #386 and dotnet/runtime@b48900f (which introduced this) - fix coming **Real Soon Now:tm:** :grin: - nits: - simplify define use now that `NETCOREAPP3_1_OR_GREATER` and so on are available - clean up .gitignore - clean up a few comments and tighten scripting up
Trying to test code that uses a service that returns
ReadOnlySpan<char>
doesn't seem possible.Using Moq Version 4.10.1
I've created a repo that reproduces the issue - https://github.com/wessiyad/moq-readonlyspan-issue
Expected outcome is that I'm able to mock the method. When I discovered this I was simply trying to verify if the method was called or not, but I could see more involved testing where the result is returned as well.
Let me know if you need more details! 😀
The text was updated successfully, but these errors were encountered: