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

System.MissingMethodException when running dotnet build #164

Open
txjmb opened this issue Apr 21, 2020 · 3 comments
Open

System.MissingMethodException when running dotnet build #164

txjmb opened this issue Apr 21, 2020 · 3 comments

Comments

@txjmb
Copy link

txjmb commented Apr 21, 2020

I am testing SharpGenTools for a project I am working on that is running in dotnet 3.1 on Linux, using the nuget packages.

When I run dotnet build, I get the following error. I received a similar error that was related to the Serialize method, then I ran dotnet add package System.Xml.XmlSerializer and now I get the same error for the Deserialize method. That method certainly exists in the System.Xml.XmlSerializer assembly, and it seems to get past the Serialize method without issue after adding that package. Any help would be appreciated. Error below:

/home/username/.nuget/packages/sharpgentools.sdk/1.2.1/build/SharpGenTools.Sdk.targets(200,5): error MSB4018: The "ParseCPlusPlus" task failed unexpectedly. [/home/username/source/test_sharpgen/test_sharpgen.csproj] /home/username/.nuget/packages/sharpgentools.sdk/1.2.1/build/SharpGenTools.Sdk.targets(200,5): error MSB4018: System.MissingMethodException: Method not found: 'System.Object System.Xml.Serialization.XmlSerializer.Deserialize(System.Xml.XmlReader)'. [/home/username/source/test_sharpgen/test_sharpgen.csproj] /home/username/.nuget/packages/sharpgentools.sdk/1.2.1/build/SharpGenTools.Sdk.targets(200,5): error MSB4018: at SharpGen.CppModel.CppModule.Read(Stream input) [/home/username/source/test_sharpgen/test_sharpgen.csproj] /home/username/.nuget/packages/sharpgentools.sdk/1.2.1/build/SharpGenTools.Sdk.targets(200,5): error MSB4018: at SharpGen.CppModel.CppModule.Read(String file) [/home/username/source/test_sharpgen/test_sharpgen.csproj] /home/username/.nuget/packages/sharpgentools.sdk/1.2.1/build/SharpGenTools.Sdk.targets(200,5): error MSB4018: at SharpGenTools.Sdk.Tasks.ParseCPlusPlus.Execute(ConfigFile config) [/home/username/source/test_sharpgen/test_sharpgen.csproj] /home/username/.nuget/packages/sharpgentools.sdk/1.2.1/build/SharpGenTools.Sdk.targets(200,5): error MSB4018: at SharpGenTools.Sdk.Tasks.SharpGenTaskBase.Execute() [/home/username/source/test_sharpgen/test_sharpgen.csproj]

@grokys
Copy link

grokys commented May 13, 2020

We were seeing this error in Avalonia too. Pinning the .NET SDK to 3.1.101 in global.json is a workaround:

"sdk": {
    "version": "3.1.101"
},

@txjmb
Copy link
Author

txjmb commented May 25, 2020

I'll give it a try. Thank you.

@ltrzesniewski
Copy link

I didn't want to downgrade the SDK version, so I worked around it by using a custom-built package which targets netstandard2.0.

I'm not sure if I should open a PR with similar changes, as this probably drops support for very old SDK versions. @jkoritzinsky please tell me if you'd like me to make a smaller/cleaner change that would just retarget the MSBuild tasks to netstandard2.0.

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

3 participants