Configuration apis using enums are broken in visual studio 16.7+
See original GitHub issueDescribe the bug
Starting with 3.0.0
the generator fails when using PropertyNameMappingStrategy.CaseInsensitive
with error message.
Could not resolve enum reflection type of PropertyNameMappingStrategy or Riok.Mapperly.Abstractions.PropertyNameMappingStrategy is not supported.
Cleaning and rebuilding as well as cleaning, closing VS and deleting the .vs
folder and reopening did not resolve the issue. Everything seems to build fine using the dotnet cli.
To Reproduce Try to build the sample code below from visual studio 2022.
Expected behavior
The generator should complete without error and Stringfield
should be mapped to StringField
Code snippets
using Riok.Mapperly.Abstractions;
namespace ConsoleApp1
{
internal class Program
{
static void Main(string[] args)
{
var mapper = new Mapper();
var from = new FromObject
{
Stringfield = "test"
};
var to = mapper.Map(from);
Console.WriteLine(to.StringField);
}
}
public class FromObject
{
public string Stringfield { get; set; }
}
public class ToObject
{
public string StringField { get; set; }
}
[Mapper(PropertyNameMappingStrategy = PropertyNameMappingStrategy.CaseInsensitive)]
public partial class Mapper
{
public partial ToObject Map(FromObject input);
}
}
Environment (please complete the following information):
- Mapperly Version: 3.0.0
- .NET Version: 6.0.411
- Target Framework: net6.0
- IDE: Visual studio 17.6.2
- OS: Windows 10
Issue Analytics
- State:
- Created a month ago
- Comments:20 (8 by maintainers)
Top Results From Across the Web
Swagger C# Enum generation - underlying int values do ...
My server is running using AspNetCore.App 2.2.0. It's configured in Startup.cs with swashbuckle aspnetcore 4.0.1 to generate a swagger json file ...
Read more >Visual Studio 2019 version 16.10 Release Notes
Get the latest features, bug fixes, and support for Visual Studio 2019 v16.10. ... Graphics Debugger - Shader-Debugging broken after update to 16.10.3?...
Read more >When are enums NOT a code smell?
IMHO, when transmitting data using enums to indicate that a field can have a value from a restricted (seldom changing) set of values...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Nice digging 👍
I can recreate the issue, VS doesn’t run for me. Even after restarting
As I’m using macOS I don’t have access to VS and it works with the cli and in Rider. Does it work again if you downgrade to
2.8.0
?