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

Throw msg exception before build nonpublic formatter. #657

Merged
merged 2 commits into from Nov 23, 2019
Merged

Conversation

neuecc
Copy link
Member

@neuecc neuecc commented Nov 21, 2019

when serializing non-public type, throws an unfriendly exception.

System.TypeLoadException: Type 'MessagePack.Formatters.Sandbox_ClassWithMissingKeyPositionsFormatter1' from assembly 'MessagePack.Resolvers.DynamicObjectResolver, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is attempting to implement an inaccessible interface.
   at System.Reflection.Emit.TypeBuilder.TermCreateClass(RuntimeModule module, Int32 tk, ObjectHandleOnStack type)
   at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock()
   at System.Reflection.Emit.TypeBuilder.CreateTypeInfo()

so check the access modifier before build formatter and throws friendly msg.

MessagePack.MessagePackSerializationException: Building dynamic formatter only allows public type. Type: Sandbox.ClassWithMissingKeyPositions

This PR includes modifications to Directory.Build.targets that have nothing to do with this title.
when edit code for Unity, I'm removing Directory.Build.props to prevent error msgs. related to #556
Then, bin and obj are generated under each project, and it is read, so it causes compile error.
Unnecessary .meta is also loaded into SolutionExplorer.
This modifies of Directory.Build.Targets is to remove the there unnecessary file.

@neuecc neuecc requested a review from AArnott November 21, 2019 14:15
@neuecc neuecc requested a review from AArnott November 22, 2019 06:09
@neuecc
Copy link
Member Author

neuecc commented Nov 22, 2019

@AArnott
#660 is very good but still requires an accessibility check also after implementing it if standard resolver does not allow private.
I pushed the code that I corrected, so I requested for a review again.

@neuecc neuecc merged commit 75756ed into master Nov 23, 2019
@neuecc neuecc deleted the improve-msg branch November 23, 2019 06:40
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

Successfully merging this pull request may close these issues.

None yet

2 participants