For some reason, I am getting the error Cannot access a disposed object. when I am trying to get the member like this: var getMember = Umbraco.Member(1234); after this line of code:
But if I try to do it before, then works fine. This started to happen after Umbraco upgrade, I can't say which upgrade started causing this because I made many, but the current version is 8.18.5
I can't determine whether the error is with the reading of the file.FileName, eg the posted file stream has been disposed (if that is the context of uploading a file,
or if it's only 'after that line' that Umbraco.Member errors? and if it's called before that line is fine?
The error message cannot access a disposed object, is usually due to a 'scope' has become stale, which could be if this is inside a 'static' class or extension method.
If not, I'm wondering if you now need to wrap your operation inside it's own scope, hard to know without the context, but have a look at this reply on another ticket about scopes and background threads:
Cannot access a disposed object.
For some reason, I am getting the error
Cannot access a disposed object.
when I am trying to get the member like this:var getMember = Umbraco.Member(1234);
after this line of code:But if I try to do it before, then works fine. This started to happen after Umbraco upgrade, I can't say which upgrade started causing this because I made many, but the current version is 8.18.5
Hi Josip
Where are you executing this code?
APIController? or SurfaceController? etc
I can't determine whether the error is with the reading of the file.FileName, eg the posted file stream has been disposed (if that is the context of uploading a file, or if it's only 'after that line' that Umbraco.Member errors? and if it's called before that line is fine?
The error message cannot access a disposed object, is usually due to a 'scope' has become stale, which could be if this is inside a 'static' class or extension method.
There is a discussion here: https://github.com/umbraco/Umbraco-CMS/issues/5073 that might help explain.
If not, I'm wondering if you now need to wrap your operation inside it's own scope, hard to know without the context, but have a look at this reply on another ticket about scopes and background threads:
https://our.umbraco.com/forum/using-umbraco-and-getting-started/102676-triggering-index-rebuild-via-hangfire-causes-objectdisposedexception-in-nucache#comment-321129
regards
Marc
is working on a reply...