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

Not compatible with .net standard #56

Open
ForgeColeColon opened this issue Nov 10, 2023 · 19 comments
Open

Not compatible with .net standard #56

ForgeColeColon opened this issue Nov 10, 2023 · 19 comments

Comments

@ForgeColeColon
Copy link

<TargetFramework>netcoreapp2.1</TargetFramework>

This is targetting .net core, not .net standard. The moment you try to instantiate NachaWriter in a .netstandard library, it errors with System.Runtime incompatibility.

Took days to figure this out, because the name of the project is literally ChoETL.NACHA.NetStandard. Should be NetCore.

@chatbot702107
Copy link

So, are you saying you were able to fix the problem? Could you tell me a little more details about your code and which version of .NET you are using?

@ForgeColeColon
Copy link
Author

Sure. I have a .csproj targeting netstandard2.0. I am not able to use NACHA.NetStandard because it is targetting netcoreapp2.1. If NACHA.NetStandard was targetting netstandard2.0, then it would be compatible with .net45, netstandard2.0, and all net core frameworks. I thought that might have been your goal with this version, but i could be wrong. So i was just throwing it out there that this is currently not compatible with netstandard2.0 projects.

@chatbot702107
Copy link

chatbot702107 commented Nov 30, 2023

hmmm, do you know if its compatible with anything like .NET6, .NET 7 or .NET 8? Based on what you said, it sounds like its only meant to work with those older deprecated frameworks...and not the new .NET stuff??

Thanks for responding so quickly.

@ForgeColeColon
Copy link
Author

Yes it is. This was what my work around was. Since the .csproj I was using it in was netstandard2.0, I had to create a new project in net6.0 and install NACHA.NetStandard there in order to keep my other project in netstandard2.0 for nuget packaging reasons.

@ForgeColeColon
Copy link
Author

Pasted simple project i just created targeting netstandard2.0 on how to reproduce.

@chatbot702107
Copy link

chatbot702107 commented Nov 30, 2023

I was bummed when my brand new .NET 8 project blew up when trying to use this ChoETL.Nacha nuget package in visual studio 2022. The C# code came from a .net 4.6.1 (4.6.2?) project that has worked fine for a while now. And after making the syntax changes to the .NET8 code, I tried to debug it and it blew up. Dang, it sounds like it might not be a lost cause.

I am so glad you are posting some stuff here. thank you!!!

@ForgeColeColon
Copy link
Author

SimpleProj

@ForgeColeColon
Copy link
Author

I believe if you just make the following change to your .csproj

<TargetFramework>netstandard2.0</TargetFramework>

everything should be fine. Would you mind trying it?

@chatbot702107
Copy link

chatbot702107 commented Nov 30, 2023

Oh wait a sec....the csproj file is set to <TargetFramework>net8.0</TargetFramework> since I created a brand new .NET8 project in visual studio, and just moved the old code into the new .NET8 project.

Because I wanted to move the old code into .NET8 while still using this choETL.NACHA. So when I changed target framework like this
<TargetFramework>netstandard2.0</TargetFramework>

Then the compiler blows up, since there are .NET8 syntax/code changes made to some parts of the code (just like loops, declarations stuff like that, but the NACHA code didnt get changed yet).

So I am wondering if I can use this and still get this ChoETL.Nacha to work with:
<TargetFramework>net8.0</TargetFramework>

@ForgeColeColon
Copy link
Author

i meant the ChoETL.NACHA.NETStandard.csproj should be netstandard2.0. that will fix problems with all projects referencing it.

@chatbot702107
Copy link

chatbot702107 commented Nov 30, 2023

i meant the ChoETL.NACHA.NETStandard.csproj should be netstandard2.0. that will fix problems with all projects referencing it.

so are you talking about downloading the code (including the ChoETL.NACHA.NETStandard.csproj ) from github (not the nuget package that I am referencing now) and changing that target framework in that downloaded github code to be like this
<TargetFramework>netstandard2.0</TargetFramework>
and then recompile that code and use it in the .NET8 project?

PS Also, I opened up that file and see this:
image

@ForgeColeColon
Copy link
Author

correct, the netcoreapp2.1 is why it is currently not working.

@chatbot702107
Copy link

chatbot702107 commented Nov 30, 2023

OK, I see. Normally I dont download and use directly from github, since visual studio has some nuget packages available for the ChoETL stuff. But in this case, I see there is the sln file in github, and the files and folders etc. So I will give that a shot, download all of it, then (make the change) and recompile it in Visual studio.
PS Any thought on which version of vs.net I should use for compiling it?

Thanks!

@ForgeColeColon
Copy link
Author

Yeah, sorry, i thought you were the code owner trying to fix this issue. This package works for me in .net 6. What breaks in .net 8?

@chatbot702107
Copy link

chatbot702107 commented Nov 30, 2023

ahh, nope not owner. Just a new user and it sounded like you were having maybe similar problem, so i thought I should at least ask. I am thinking if its working for your .NET 6, then it should hopefully work for me too in .NET8. That would be very good!

I posted an issue here. Basically it dies as soon as it tries to execute this in the for loop
foreach (var data in new ChoNACHAReader(filename))
#57

@ForgeColeColon
Copy link
Author

ForgeColeColon commented Nov 30, 2023

try this:
var builder = new StringBuilder(File.ReadAllText(fileName));
foreach (var data in new ChoNACHAReader(builder))
{

		}

@chatbot702107
Copy link

thanks. Will give it a try and let you know. :-)

@ForgeColeColon
Copy link
Author

Did that end up working? I believe it should have, cause it bypasses the GetEncoding call that was causing your error.

@chatbot702107
Copy link

chatbot702107 commented Dec 1, 2023

Thanks again!.....So, been testing it, seems to have worked. Need to do more testing tomorrow though. I am wondering why GetEncoding was blowing up. Did you encounter issues with it blowing up in your .NET 6 app?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants