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

Deserialization problem caused by Type in AbpCache data #4709

Open
realLiangshiwei opened this issue Jul 18, 2019 · 7 comments
Open

Deserialization problem caused by Type in AbpCache data #4709

realLiangshiwei opened this issue Jul 18, 2019 · 7 comments
Assignees
Labels
Milestone

Comments

@realLiangshiwei
Copy link
Contributor

In the design of ABP, each cached data will have type Type information, and use type to deserialize data when getting cache.

private static StringBuilder SerializeType(Type type, bool withAssemblyName = true, StringBuilder typeNameBuilder = null)

But in different projects or solutions, the type of assembly is inconsistent with the namespace, which will cause deserialization exceptions.

return objbyte.HasValue ? Deserialize(objbyte) : null;

@ryancyq
Copy link
Contributor

ryancyq commented Jul 18, 2019

Hi @liangshiw , can you give an example of this?

@realLiangshiwei
Copy link
Contributor Author

Cache.zip

Write the cache in the Account project, read the cache in Order. You will see the error message.
This can be avoided by putting the User class in the shared project, but not all projects are suitable for the same solution. I think this is a design problem with ABP cache.

@maliming
Copy link
Member

Related: #3219

We should consider enhancing it.

@maliming maliming self-assigned this Jul 19, 2019
@ismcagdas ismcagdas added this to the v4.9 milestone Jul 19, 2019
@maliming
Copy link
Member

maliming commented Jul 23, 2019

dev...maliming/redisWithoutType

If we remove the Type in Redis. This will be breaking change.
once updated, the previous cache will be invalid. The previous redis cache must be emptied.

Should we make compatible code for this?

@hikalkan
Copy link
Member

The previous redis cache must be emptied

The cache should be cleared on deployment. I don't know how we can do this automatically.

@LuoyeAn
Copy link

LuoyeAn commented May 6, 2021

any solution now?

@maliming
Copy link
Member

maliming commented May 7, 2021

@TingtingAn
You can use a common assembly.

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

Successfully merging a pull request may close this issue.

6 participants