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

[Issue]: .net7 breaking change collectible-assemblies #11251

Open
1 task done
jumoog opened this issue Mar 29, 2024 · 9 comments · May be fixed by #11259
Open
1 task done

[Issue]: .net7 breaking change collectible-assemblies #11251

jumoog opened this issue Mar 29, 2024 · 9 comments · May be fixed by #11259
Labels
bug Something isn't working

Comments

@jumoog
Copy link

jumoog commented Mar 29, 2024

Please describe your bug

A breaking change in .net7 affects Emby.Server.Implementations.Serialization.MyXmlSerializer

https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/7.0/collectible-assemblies

Reproduction Steps

update plugin build from .net6 (10.8) to .net8 (10.9)

related: ConfusedPolarBear/intro-skipper#174

Jellyfin Version

Unstable (master branch)

if other:

No response

Environment

Docker

Jellyfin logs

[2024-03-28 23:48:18.715 +01:00] [ERR] [21] Emby.Server.Implementations.ScheduledTasks.TaskManager: Error executing Scheduled Task
System.AggregateException: One or more errors occurred. (A non-collectible assembly may not reference a collectible assembly.)
 ---> System.NotSupportedException: A non-collectible assembly may not reference a collectible assembly.
   at System.Reflection.Emit.RuntimeModuleBuilder.<GetTypeRef>g____PInvoke|13_0(QCallModule __module_native, UInt16* __strFullName_native, QCallModule __refedModule_native, Int32 __tkResolution_native)
   at System.Reflection.Emit.RuntimeModuleBuilder.GetTypeTokenWorkerNoLock(Type type, Boolean getGenericDefinition)
   at System.Reflection.Emit.RuntimeModuleBuilder.GetTypeTokenInternal(Type type, Boolean getGenericDefinition)
   at System.Reflection.Emit.SignatureHelper.AddOneArgTypeHelperWorker(Type clsArgument, Boolean lastWasGenericInst)
   at System.Reflection.Emit.SignatureHelper.AddOneArgTypeHelperWorker(Type clsArgument, Boolean lastWasGenericInst)
   at System.Reflection.Emit.RuntimeILGenerator.DeclareLocal(Type localType, Boolean pinned)
   at System.Xml.Serialization.CodeGenerator.DeclareLocal(Type type, String name)
   at System.Xml.Serialization.CodeGenerator.DeclareOrGetLocal(Type type, String name)
   at System.Xml.Serialization.ReflectionAwareILGen.WriteArrayLocalDecl(String typeName, String variableName, SourceInfo initValue, TypeDesc arrayTypeDesc)
   at System.Xml.Serialization.XmlSerializationWriterILGen.WriteElement(SourceInfo source, ElementAccessor element, String arrayName, Boolean writeAccessor)
   at System.Xml.Serialization.XmlSerializationWriterILGen.WriteElements(SourceInfo source, String enumSource, ElementAccessor[] elements, TextAccessor text, ChoiceIdentifierAccessor choice, String arrayName, Boolean writeAccessors, Boolean isNullable)
   at System.Xml.Serialization.XmlSerializationWriterILGen.WriteMember(SourceInfo source, String choiceSource, ElementAccessor[] elements, TextAccessor text, ChoiceIdentifierAccessor choice, TypeDesc memberTypeDesc, Boolean writeAccessors)
   at System.Xml.Serialization.XmlSerializationWriterILGen.GenerateTypeElement(XmlTypeMapping xmlTypeMapping)
   at System.Xml.Serialization.TempAssembly.GenerateRefEmitAssembly(XmlMapping[] xmlMappings, Type[] types)
   at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location)
   at System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace, String location)
   at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
   at Emby.Server.Implementations.Serialization.MyXmlSerializer.<>c.<GetSerializer>b__1_0(String _, Type t)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd[TArg](TKey key, Func`3 valueFactory, TArg factoryArgument)
   at Emby.Server.Implementations.Serialization.MyXmlSerializer.GetSerializer(Type type)
   at Emby.Server.Implementations.Serialization.MyXmlSerializer.SerializeToWriter(Object obj, XmlWriter writer)
   at Emby.Server.Implementations.Serialization.MyXmlSerializer.SerializeToStream(Object obj, Stream stream)
   at Emby.Server.Implementations.Serialization.MyXmlSerializer.SerializeToFile(Object obj, String file)
   at ConfusedPolarBear.Plugin.IntroSkipper.Plugin.SaveTimestamps()
   at ConfusedPolarBear.Plugin.IntroSkipper.Plugin.UpdateTimestamps(Dictionary`2 newTimestamps, AnalysisMode mode)
   at ConfusedPolarBear.Plugin.IntroSkipper.ChapterAnalyzer.AnalyzeMediaFiles(ReadOnlyCollection`1 analysisQueue, AnalysisMode mode, CancellationToken cancellationToken)
   at ConfusedPolarBear.Plugin.IntroSkipper.BaseItemAnalyzerTask.AnalyzeItems(ReadOnlyCollection`1 items, CancellationToken cancellationToken)
   at ConfusedPolarBear.Plugin.IntroSkipper.BaseItemAnalyzerTask.<>c__DisplayClass5_0.<AnalyzeItems>b__0(KeyValuePair`2 season)
   at System.Threading.Tasks.Parallel.<>c__DisplayClass43_0`2.<PartitionerForEachWorker>b__1(IEnumerator& partitionState, Int64 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Parallel.<>c__DisplayClass43_0`2.<PartitionerForEachWorker>b__1(IEnumerator& partitionState, Int64 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
   at System.Threading.Tasks.TaskReplicator.Replica.Execute()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction`1 action, ParallelOptions options, Boolean stopOnFirstFailure)
   at System.Threading.Tasks.Parallel.PartitionerForEachWorker[TSource,TLocal](Partitioner`1 source, ParallelOptions parallelOptions, Action`1 simpleBody, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Parallel.PartitionerForEachWorker[TSource,TLocal](Partitioner`1 source, ParallelOptions parallelOptions, Action`1 simpleBody, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
   at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
   at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body)
   at ConfusedPolarBear.Plugin.IntroSkipper.BaseItemAnalyzerTask.AnalyzeItems(IProgress`1 progress, CancellationToken cancellationToken)
   at ConfusedPolarBear.Plugin.IntroSkipper.DetectCreditsTask.ExecuteAsync(IProgress`1 progress, CancellationToken cancellationToken)
   at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options)

FFmpeg logs

No response

Please attach any browser or client logs here

No response

Please attach any screenshots here

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jumoog jumoog added the bug Something isn't working label Mar 29, 2024
@jellyfin-bot
Copy link
Contributor

Hi, it seems like your issue report has the following item(s) that need to be addressed:

  • The title of this issue report is empty. Please change it to something descriptive.
  • The format of the environment section has been altered from the template.
  • You have not provided any ffmpeg logs. They should be included if transcoding or remuxing.

This is an automated message, currently under testing. Please file an issue here if you encounter any problems.

@jumoog jumoog changed the title [Issue]: [Issue]: .net7 breaking change collectible-assemblies Mar 29, 2024
@crobibero
Copy link
Member

I'm not sure if there is anything we can do to resolve this.
It would likely be best to just cache the xml serializer in the plugin

@jellyfin-bot jellyfin-bot added this to Needs triage in Issue Triage for Main Repo Mar 30, 2024
@oddstr13
Copy link
Member

oddstr13 commented Mar 30, 2024

Relevant docs on the error; https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/7.0/collectible-assemblies
Edit: missed your link in the OP 😅

@gnattu
Copy link
Member

gnattu commented Mar 30, 2024

Hello, do you have a more supported plugin that can easily reproduce this issue?

The plugin you pointed to is not going to work with Jellyfin 10.9, even without this problem.

When we are evaluating mitigation paths we want to verify the functionality as well.

@gnattu
Copy link
Member

gnattu commented Mar 30, 2024

I downloaded your build of 10.9 preview: https://github.com/jumoog/intro-skipper/releases/tag/10.9%2Fpreview

And I performed both analyzation on a library with more than 200 episodes, and both successes without the exception raised:

image

Please provide more detailed reproduction step otherwise we cannot do much to test our theories.

@phyzical
Copy link

image

just jumped across to linux servers nightly build can confirm it seems to be plotting along for me too after manually installing the above dll

@jumoog
Copy link
Author

jumoog commented Mar 30, 2024

I downloaded your build of 10.9 preview: jumoog/intro-skipper@10.9%2Fpreview (release)

And I performed both analyzation on a library with more than 200 episodes, and both successes without the exception raised:
image

Please provide more detailed reproduction step otherwise we cannot do much to test our theories.

I no longer have this problem because I now use DataContractSerializer.

But I reported the problem because it may affect others.

@gnattu
Copy link
Member

gnattu commented Mar 30, 2024

I no longer have this problem because I now use DataContractSerializer.

But I reported the problem because it may affect others.

We will need a reproducible example to test our theory and fix things.

I tried to mimic the xml behavior in a newly created plugin but it does not raise the exception for me.

@gnattu
Copy link
Member

gnattu commented Mar 30, 2024

Alright, just reproduced successfully with your migration reverted.

I'm going to post a potential fix for discussion.

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
Status: In Progress
6 participants