-
Notifications
You must be signed in to change notification settings - Fork 568
SGen doesn't work with reference assemblies (?) #3991
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
From @DanTup on Wednesday, November 8, 2017 8:50:22 AM The detailed error also contains a more specific explanation:
We've hit this after migrating to PackageReference - MSBuild now passes additional DLLs (including some ref assemblies) to sgen. This means in many cases, switching to PackageReference may require disabling generation of serialisation assemblies (which could be an extra risk, relying on them to be created at runtime, as well as a perf hit). To add furtehr confusion, with GenerateSerializationAssemblies set to Auto (the default), this happens to us in Release builds but not Debug (both configs are set to Auto). I don't know if auto means "on for release builds and off for debug builds" but it seems to behave that way for our project at least! |
From @radical on Wednesday, November 8, 2017 3:56:49 PM
It does:
|
From @DanTup on Wednesday, November 8, 2017 6:29:10 PM @radical Aha, thanks! I did Google for an answer but turned up nothing. Strange that if that's what it does that my csproj have separate elements for this setting in both Release and Debug both set to Auto by default - if the default is on-for-release and off-for-debug, putting the values in directly would remove some confusion over what Auto means (or indeed, why it means something different depending on whether the configuration name is the magic string "Debug"!). |
From @emmanuelguerin on Thursday, November 9, 2017 2:14:01 PM I've submitted a ticket in the SDK: |
From @jnm2 on Tuesday, November 14, 2017 8:39:08 PM My company just ran into this, but only if we add a package reference to SourceLink.Embed.AllSourceFiles. With that reference, msbuild gives this:
I can't tell if this is entirely related? The project itself is targeting |
From @jnm2 on Tuesday, November 14, 2017 8:46:37 PM Workaround for me is <PackageReference Include="SourceLink.Embed.AllSourceFiles" Version="2.5.0" ExcludeAssets="compile" /> Is that a bug in the package? It shouldn't be adding references to my project, only messing with build targets to pass |
From @rainersigwald on Friday, December 22, 2017 5:20:43 PM This will only get more common as people move to new-style projects + NuGet. Pulling into 15.6, at least for triage so we don't forget it. |
From @AndrewGretton on Friday, May 4, 2018 2:56:08 PM Just a "me too" comment, that we're migrating to new-style projects and we've hit this issue today - I figure we missed the 15.6 milestone for this issue. I'm going to explore disabling serialization assembly generation, but obviously I'd rather not. Cheers! |
From @mattwhetton on Wednesday, August 22, 2018 9:23:16 AM Another "me too" here. Is there any planned fix for this? |
From @theCorb1nator on Monday, December 17, 2018 11:39:42 PM Just another “me too” comment |
From @rfcdejong on Wednesday, January 23, 2019 3:38:57 PM me too.... |
From @bdemolder on Tuesday, February 12, 2019 11:54:30 AM This is still happening for certain projects here as well, is there any other workaround besides turning off that serialization? |
From @zeng16107 on Monday, June 17, 2019 9:31:34 AM me too. i also met the same issue in the vs 2019, .net framework 4.7.2. Severity Code Description Project File Line Suppression State |
From @morrisond91 on Monday, June 17, 2019 10:23:09 AM Me too. same error Severity Code Description Project File Line Suppression State |
From @Ujinjinjin on Monday, July 22, 2019 12:29:56 PM Well, 'me too'. We are using .net 4.7.2 and both new and old format of .csproj files in different projects. Error occurred after referencing new package. |
From @dbeattie71 on Tuesday, July 23, 2019 9:05:48 PM Same issue with 4.8. |
From @chadsmiley on Monday, September 23, 2019 2:07:39 PM In our implementation, I was able to exclude the reference from compile.
https://docs.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files |
From @toebens on Tuesday, October 8, 2019 11:08:29 AM We have the problem with .net 4.7.2 in Release mode. Unfortunately we can not disable GenerateSerializationAssemblies as our assembly makes heavy use of xmlserializer + WCF. The (initial) performance drop at runtime would be too bad. We added Stackexchange.Redis 2.0.601 to our project that is having a dependency on System.Buffers.dll and some other netstandard2.0 assemblies. Can you please fix this ASAP? Meanwhile, is there any other workaround? |
From @toebens on Monday, October 14, 2019 7:40:16 AM @KirillOsenkov do you have any timeline when this problem will be solved? |
From @KirillOsenkov on Monday, October 14, 2019 3:11:43 PM |
From @Jmales on Wednesday, October 23, 2019 10:36:49 AM Having this problem as well. |
Isn't this repository just dotnet client WCF? Please note that this problem is happening on msbuild .net framework projects when those are having .netstandard2.0 references in Release build |
I just noticed that using sgen.exe via command-line with the project's dll ends successfully and generates the Serialized dll, while using it in the csproj gives the reported problems. So why is it that using sgen in the csproj ends differently from running sgen via command-line? I ran with -v:diag and made sure that sgen.exe version being used between the csproj and the command-line were the same, i.e. Windows\v10.0A\bin\NETFX 4.7.2 Tools\sgen.exe |
The workaround posted from Jmales should work, and I would think the difference is running directly from the csproj will try to find all references and not handle package references correctly, but the sgen.exe tool takes the references needed as parameters so you can pass them in such that it will find them and run. Since this is the old sgen tool that is part of .NET Framework which is in maintenance mode, I would suggest using a workaround similar to what Jmales suggested. If you don't want to use the tool manually and want it as part of the build you can add a post-build step with an exec task that runs sgen.exe with the needed parameters, then you can get the desired behavior without the manual step. |
Another "Me Too". In my case it works allright with the configurations But it fails only on I cannot discover anything that would make the release 32bit (X86) version different other than what it is supposed to do. The config is:
What @dasetser calls a "workaround" does not work for me, I get exactly the same results via the commandline. I don't think @Jmales was proposing it as a workaround at all, he was just adding some info and inquiring for hints why the result was different. I'm running the version from C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\sgen.exe but it fails on the buildserver and other machines as well. ---- EDIT ---- I had removed some |
From @KirillOsenkov on Tuesday, November 7, 2017 9:06:31 PM
Steps to reproduce
Expected behavior
Should build.
Actual behavior
Environment data
msbuild /version
output:15.3.409.57025
Copied from original issue: dotnet/msbuild#2707
The text was updated successfully, but these errors were encountered: