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

Object not serializable (Csla.Core.ContextDictionary) after compiled with .Net Native tool chain and Optimize Code Enabled #962

Closed
SachinPNikam opened this issue Nov 2, 2018 · 21 comments
Assignees
Labels

Comments

@SachinPNikam
Copy link

Describe the bug
I am getting run time error the Object not serializable (Csla.Core.ContextDictionary) after compiled with .Net Native tool chain and Optimize Code Enabled

Version and Platform
CSLA version: 4.8.1
OS: Windows 10 -177663
Platform: UWP -

Additional context

image

@rockfordlhotka
Copy link
Member

Are you using MobileFormatter or BinaryFormatter or something else?

@SachinPNikam
Copy link
Author

Hello rocky, Actually above error I am getting only at the time when I complie the uwp app with .Net Native tool chain. If it is normal compile I am am not getting this error . application I used MobileFormatter when ever needed but not in above page .

@SachinPNikam
Copy link
Author

hello rocky,
I have attached uwp test app zip which reproduces the issue.

test.zip

@SachinPNikam
Copy link
Author

Hello rocky
Any suggestion most welcome .Thanking you in advance for your time and consideration.due to above issue not able to submit the app to store .

@rockfordlhotka
Copy link
Member

Just tried building your test app, but the zip is missing files so it can't build.

@SachinPNikam
Copy link
Author

ohh ! let me upload once again

@SachinPNikam
Copy link
Author

SachinPNikam commented Nov 8, 2018

test.zip
I uploaded App once again just rebuild the solution. RefDll contains e2.BDM.Lib reference .
Thanks for Quick response !!

@rockfordlhotka
Copy link
Member

It built for me, though with some warnings.

1>------ Build started: Project: test, Configuration: Release x86 ------
1>  test -> E:\src\test\test\test\bin\x86\Release\test.exe
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0010: Could not find assembly 'e2.SLM.Lib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' referenced by 'e2.BDM.Lib'.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0010: Could not find assembly 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' referenced by 'e2.BDM.Lib'.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0010: Could not find assembly 'e2.SLM.Lib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' referenced by 'e2.BDM.Lib'.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0010: Could not find assembly 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' referenced by 'e2.BDM.Lib'.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0010: Could not find assembly 'e2.SLM.Lib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' referenced by 'e2.BDM.Lib'.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0010: Could not find assembly 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' referenced by 'e2.BDM.Lib'.
1>  Processing application code
1>  Computing application closure and generating interop code
1>    Loading 103 modules...
1>    Generating code...
1>    Interop code generated.
1>  Generating serialization code
1>  Compiling interop code
1>  Generating System.Reflection.DispatchProxy proxy code.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0005: Type 'Newtonsoft.Json.JsonPropertyAttribute' from assembly 'Newtonsoft.Json' was not included in compilation, but was referenced in type 'e2.BDM.Lib.DefaultSetModel'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0012: Attribute constructor 'JsonPropertyAttribute..ctor(string)' from assembly 'Newtonsoft.Json' was not included in the compilation. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0005: Type 'Newtonsoft.Json.JsonConvert' from assembly 'Newtonsoft.Json' was not included in compilation, but was referenced in method 'CarrierInfoDtlJSONObj.DeserializeJSON(string)'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0003: Method 'CarrierInfoDtlJSONObj.DeserializeJSON(string)' will always throw an exception due to the missing method 'JsonConvert.DeserializeObject<CarrierInfoDtlJSONObjModel>(string)' in assembly 'Newtonsoft.Json'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0003: Method 'CarrierInfoDtlJSONObj.SerializeJSON()' will always throw an exception due to the missing method 'JsonConvert.SerializeObject(object)' in assembly 'Newtonsoft.Json'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0003: Method 'Carrier.GetCustomerDefaultFreightBillingSet(string)' will always throw an exception due to the missing method 'JsonConvert.DeserializeObject<object>(string)' in assembly 'Newtonsoft.Json'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0003: Method 'Carrier.GetCustomerDefaultFreightBillingSetPackageTypeDtls()' will always throw an exception due to the missing method 'JsonConvert.DeserializeObject<object>(string)' in assembly 'Newtonsoft.Json'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0003: Method 'Carrier.GetCustomerDefaultRateSetDtlByPackageType(string)' will always throw an exception due to the missing method 'JsonConvert.DeserializeObject<object>(string)' in assembly 'Newtonsoft.Json'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0003: Method 'Carrier.GetCustomerDefaultFreightBillingSetTermsNLimitsDtl(string)' will always throw an exception due to the missing method 'JsonConvert.DeserializeObject<object>(string)' in assembly 'Newtonsoft.Json'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0003: Method 'Carrier.ValidateDefaultConfigInfo.Execute(IRuleContext)' will always throw an exception due to the missing method 'JsonConvert.DeserializeObject<object>(string)' in assembly 'Newtonsoft.Json'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0005: Type 'e2.SLM.Lib.Security.SLMPrincipal' from assembly 'e2.SLM.Lib' was not included in compilation, but was referenced in method 'CarrierNCVList.<GetALLCarrierNCVListAsync>d__9.MoveNext()'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0003: Method 'CarrierNCVList.<GetALLCarrierNCVListAsync>d__9.MoveNext()' will always throw an exception due to the missing method 'SLMPrincipal.GetUserPropertyList(string)' in assembly 'e2.SLM.Lib'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0003: Method 'CarrierNCVList.<GetSMMCarrierNCVListAsync>d__10.MoveNext()' will always throw an exception due to the missing method 'SLMPrincipal.GetUserPropertyList(string)' in assembly 'e2.SLM.Lib'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0003: Method 'CarrierNCVList.<GetBDMCarrierNCVListAsync>d__11.MoveNext()' will always throw an exception due to the missing method 'SLMPrincipal.GetUserPropertyList(string)' in assembly 'e2.SLM.Lib'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0003: Method 'CarrierNCVList.<GetOMMCarrierNCVListAsync>d__12.MoveNext()' will always throw an exception due to the missing method 'SLMPrincipal.GetUserPropertyList(string)' in assembly 'e2.SLM.Lib'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0003: Method 'CarrierNCVList.<GetRMMCarrierNCVListAsync>d__13.MoveNext()' will always throw an exception due to the missing method 'SLMPrincipal.GetUserPropertyList(string)' in assembly 'e2.SLM.Lib'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.1.8\tools\Microsoft.NetNative.targets(788,5): warning : ILTransform : warning ILT0003: Method 'CarrierNCVList.<GetSZMCarrierNCVListAsync>d__14.MoveNext()' will always throw an exception due to the missing method 'SLMPrincipal.GetUserPropertyList(string)' in assembly 'e2.SLM.Lib'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.
1>  Cleaning up unreferenced code
1>  Generating native code
1>  Generating fixups for native code
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

@SachinPNikam
Copy link
Author

SachinPNikam commented Nov 8, 2018

okay no Problem just Run the run Project you will get that run time error which is getting to any server call

@SachinPNikam
Copy link
Author

SachinPNikam commented Nov 8, 2018

RefDll.zip
if needed RefDll

@rockfordlhotka
Copy link
Member

The app does instantly crash - but I don't see an error message displayed.

I thought this was a compiler/build failure? But you are saying this is a runtime error?

@SachinPNikam
Copy link
Author

Yes it will crash . In test App I didn’t added try catch in MainPage.cs there is server call to get the company info .if you put the debugging point you will get the errorinfo while bebuging . This issue is only coming when App compiles with .Net Native tool chains enabled .which is prerequisites for store upload.

@rockfordlhotka
Copy link
Member

rockfordlhotka commented Nov 8, 2018

OK, I got a failure using this code

var dictionary = new Csla.Core.ContextDictionary
	{
		{ 123, 456 }
	};
dictionary = (Csla.Core.ContextDictionary)Csla.Core.ObjectCloner.Clone(dictionary);

So there's clearly an issue.

@rockfordlhotka rockfordlhotka self-assigned this Nov 8, 2018
@rockfordlhotka rockfordlhotka added this to To do in Version 4.9.0 via automation Nov 8, 2018
@SachinPNikam
Copy link
Author

Thanks rocky !!

@rockfordlhotka
Copy link
Member

I'm not sure what the issue is or how to solve it yet - perhaps the native toolchain is optimizing away parts of the code or something?

@SachinPNikam
Copy link
Author

SachinPNikam commented Nov 8, 2018

Not sure what’s the issue but it works fine with csla 4.6.603

@rockfordlhotka
Copy link
Member

Found the issue, so 4.9 will have the fix.

rockfordlhotka added a commit to rockfordlhotka/csla that referenced this issue Nov 8, 2018
@rockfordlhotka
Copy link
Member

@SachinPNikam I am pushing a 4.9.0 prerelease to NuGet as I type this, so you should be able to try the preview and confirm that is resolves this issue.

@SachinPNikam
Copy link
Author

Thanks rocky ..I will check with this prerelease..

@rockfordlhotka rockfordlhotka moved this from To do to Done in Version 4.9.0 Nov 9, 2018
@rockfordlhotka rockfordlhotka moved this from Done to In progress in Version 4.9.0 Nov 9, 2018
@SachinPNikam
Copy link
Author

With 4.9.0 PreRelease the above issue resolved . there is still other issue which is not related this that i will raise as new. Thanks you so much rocky for the PreRelease .

Version 4.9.0 automation moved this from In progress to Done Nov 9, 2018
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
No open projects
Version 4.9.0
  
Done
Development

No branches or pull requests

2 participants