Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: "is not marked as serializable" error with Q8 for AnyCPU

$
0
0
Hi All !

I'm French. So, sorry for my very bad English and please talk simply if you can.

I try to use MagickImage. I installed with Nuget Package Manager : Q8 version for AnyCPU. My project is a Web MVC 4 project with C#.
Then, my code :
                        MagickAnyCPU.CacheDirectory = Server.MapPath("~/Files");
                        MagickReadSettings settings = new MagickReadSettings();
                        settings.Density = new PointD(300, 300);
                        using (MagickImageCollection images = new MagickImageCollection())
                        {
                            images.Read(Path.Combine(path, fileName), settings); //"fileName" is declared before
                            using (MagickImage vertical = images.AppendVertically())
                            {
                                vertical.Write(Path.Combine(path, Path.GetFileNameWithoutExtension(fileName) + ".pdf"));
                            }
                        }
But i get an error :
Server Error in '/' Application.

Type 'Martin3D.Website.ApplicationIdentity' in Assembly 'Martin3D.Website, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Runtime.Serialization.SerializationException: Type 'Martin3D.Website.ApplicationIdentity' in Assembly 'Martin3D.Website, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.

Source Error: 


Line 168:                        //Conversion en image et sauvegarde
Line 169:                        MagickAnyCPU.CacheDirectory = Server.MapPath("~/Files");
Line 170:                        MagickReadSettings settings = new MagickReadSettings();
Line 171:                        settings.Density = new PointD(300, 300);
Line 172:                        using (MagickImageCollection images = new MagickImageCollection())

Source File: d:\Developpement\Projets Visual Studio\Site Martin3D\site\Martin3D.Website\Controllers\ContactController.cs    Line: 170 

Stack Trace: 


[SerializationException: Type 'Martin3D.Website.ApplicationIdentity' in Assembly 'Martin3D.Website, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.]
   System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +11080899
   System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +336
   System.AppDomain.get_Id() +0
   <CrtImplementationDetails>.DoCallBackInDefaultDomain(IntPtr function, Void* cookie) +241
   <CrtImplementationDetails>.DefaultDomain.Initialize() +30
   <CrtImplementationDetails>.LanguageSupport.InitializeDefaultAppDomain(LanguageSupport* ) +46
   <CrtImplementationDetails>.LanguageSupport._Initialize(LanguageSupport* ) +504
   <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* ) +157

[ModuleLoadException: The C++ module failed to load while attempting to initialize the default appdomain.
]
   <CrtImplementationDetails>.ThrowModuleLoadException(String errorMessage, Exception innerException) +66
   <CrtImplementationDetails>.LanguageSupport.Initialize(LanguageSupport* ) +219
   .cctor() +46

[TypeInitializationException: The type initializer for '<Module>' threw an exception.]
   System.Delegate.BindToMethodInfo(Object target, IRuntimeMethodInfo method, RuntimeType methodType, DelegateBindingFlags flags) +0
   System.Delegate.CreateDelegateNoSecurityCheck(Type type, Object target, RuntimeMethodHandle method) +109
   System.Reflection.Emit.DynamicMethod.CreateDelegate(Type delegateType) +53
   Fasterflect.Emitter.MethodInvocationEmitter.CreateDelegate() +451
   Fasterflect.Emitter.BaseEmitter.GetDelegate() +125
   Fasterflect.MethodExtensions.DelegateForCallMethod(Type type, Type[] genericTypes, String name, Flags bindingFlags, Type[] parameterTypes) +85
   Fasterflect.MethodExtensions.DelegateForCallMethod(Type type, String name, Type[] parameterTypes) +53
   Fasterflect.MethodExtensions.CallMethod(Object obj, String name, Type[] parameterTypes, Object[] parameters) +29
   ImageMagick.AssemblyHelper.LoadAssembly(String cacheDirectory, String tempFile) +186
   ImageMagick.AssemblyHelper.LoadAssembly() +151

[InvalidOperationException: Failed to load embedded x86 assembly: unable to initialize Magick.NET]
   ImageMagick.AssemblyHelper.get_Assembly() +162
   ImageMagick.Types.get_MagickReadSettings() +25
   ImageMagick.MagickReadSettings..ctor() +11
   Martin3D.Website.Controllers.ContactController.Step1(ContactStep1ViewModel model) in d:\Developpement\Projets Visual Studio\Site Martin3D\site\Martin3D.Website\Controllers\ContactController.cs:170
   lambda_method(Closure , ControllerBase , Object[] ) +104
   System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
   System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +208
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
   System.Web.Mvc.Async.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41() +28
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +10
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +48
   System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() +57
   System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +223
   System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +48
   System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +24
   System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +102
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +43
   System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +14
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +57
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +47
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
   System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +25
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +47
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9651116
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34212
I tried to find a solution on this forum, without success.

Thank you by advance,

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>