Skip to content
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

v2.0.3 does not work with fresh generated library based on netstandard2.0 #13

Closed
LeonhardFischl opened this issue Mar 12, 2022 · 7 comments · Fixed by #17
Closed

v2.0.3 does not work with fresh generated library based on netstandard2.0 #13

LeonhardFischl opened this issue Mar 12, 2022 · 7 comments · Fixed by #17
Assignees
Labels
bug Something isn't working

Comments

@LeonhardFischl
Copy link

LeonhardFischl commented Mar 12, 2022

Hi,
I´m following your project since I saw your great video module on pluralsight.
Since that I`m waiting on the version 2 which applies muich easier ways to generate code.
Thanks for your great work by the way.

Unfortunately it seems that the current version 2.0.3 is not completely compatible with netstandard 2.0. I have to use it because my project is still based on .Net Framework 4.8 and not yet ported to .net 3.1 neigher to .net 5 or 6.

I`m using your package in a own library which depends also on my model library which is still targeting ".Net Framework 4.8". Do I have to change the target framework to ".netstandard2.0" as well?

When I´m trying to build the project, it shows me the following error:
image

My first thought was that I have to enable nullable types in my project but this did not help neigther

The error occures in:
BuilderBaseClass.cs 28

Can you check this please?
Thanks a lot
Greetings from Munich (Bavaria, Germany)

@MelGrubb
Copy link
Owner

Sorry for the late reply. I never got a notification about this. It's possible it got lost in a spam filter somewhere because I know I've been getting notifications for other repos I'm part of.

Anyway. I need to get back to this. I put things on hold because so far I've been dissatisfied with Visual Studio's support for building source generators so far. Once they're built they work just fine, but the authoring and debugging process itself is still far too painful. It's getting a little better though.

I'm hoping to have a fully working and customizable BuilderGenerator in place before my previous course goes stale enough to justify redoing things, or maybe just the last module. I'll run a quick test and see what I find though.

@MelGrubb
Copy link
Owner

I just created a brand new netstandard2.0 project and added builders to it. I didn't get the same error you've included above, but I did get an error that sounds more closely related to your description. Instead, I got:
Feature 'nullable reference types' is not available in C# 7.3. Please use language version 8.0 or greater.
That error is originating from inside a base class though, so I'd have to go see if I can rephrase the code in BuilderBaseClass to not use nullable types. I'll give it a shot.

@MelGrubb
Copy link
Owner

I'm going to need to test this out a bit before I create a new version, but I think that if I make the generated code so that it's unaware of nullable types then it's going to be unhappy in .Net 5+ projects. Since that's the future, that's what I'm targeting now.

@LeonhardFischl
Copy link
Author

Thanks a lot for your respond.

Meanwhile I forked the project and tried sth. by myself but without a result I´m fine with.
My first idea was to just remove the nullable reference but it did not work. The second thought was to use an attribute to configure the "nullable types". Do you think that could work also for .Net 5+ projects?

@LeonhardFischl
Copy link
Author

Hi,
do you have any update for me?
Any changes on the way to .net 6.x?

@MelGrubb
Copy link
Owner

MelGrubb commented Jul 6, 2022

I am finishing up the last module of a new Pluralsight course this week and next. After that, I'll be free to get back to the generator and I hope to have some blog content about that when I'm done as well.

@MelGrubb
Copy link
Owner

MelGrubb commented Aug 7, 2022

I wanted to let you know I'm back on this, and I can see the same error as you now, down to the line number, so that's a good start.

@MelGrubb MelGrubb self-assigned this Aug 7, 2022
@MelGrubb MelGrubb added the bug Something isn't working label Aug 7, 2022
MelGrubb added a commit that referenced this issue Aug 7, 2022
@MelGrubb MelGrubb linked a pull request Aug 7, 2022 that will close this issue
MelGrubb added a commit that referenced this issue Aug 7, 2022
* Merged from main

* #13 fixed netstandard2.0 compatibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants