Another System.NullReferenceException
brutaldev opened this issue · 1 comments
Sometimes Smocks randomly fails all Run
calls and never recovers again. Changing the static method names in the Setup
calls makes it works again for a while until it breaks again. Changing names back to their original makes things work again...
System.NullReferenceException : Object reference not set to an instance of an object.
Result StackTrace:
Server stack trace:
at Mono.Cecil.Pdb.PdbWriter.DefineSequencePoints(Collection1 sequence_points) at Mono.Cecil.Pdb.PdbWriter.Write(MethodDebugInformation info) at Mono.Cecil.Cil.CodeWriter.WriteResolvedMethodBody(MethodDefinition method) at Mono.Cecil.Cil.CodeWriter.WriteMethodBody(MethodDefinition method) at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method) at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type) at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type) at Mono.Cecil.MetadataBuilder.AddNestedTypes(TypeDefinition type) at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type) at Mono.Cecil.MetadataBuilder.AddTypeDefs() at Mono.Cecil.MetadataBuilder.BuildTypes() at Mono.Cecil.MetadataBuilder.BuildModule() at Mono.Cecil.ModuleWriter.<>c.<BuildMetadata>b__1_0(MetadataBuilder builder, MetadataReader _) at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func
3 read)
at Mono.Cecil.ModuleWriter.BuildMetadata(ModuleDefinition module, MetadataBuilder metadata)
at Mono.Cecil.ModuleWriter.WriteModuleTo(ModuleDefinition module, Disposable`1 stream, WriterParameters parameters)
at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
at Mono.Cecil.AssemblyDefinition.Write(String fileName, WriterParameters parameters)
at Smocks.IL.AssemblyRewriter.Rewrite(String path)
at Smocks.AppDomains.AssemblyLoaderFactory.GetLoaderForAssembly(AssemblyName assemblyName)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Smocks.AppDomains.IAssemblyLoaderFactory.GetLoaderForAssembly(AssemblyName assemblyName)
at Smocks.AppDomains.AssemblyResolver.LoadAssembly(AssemblyName assemblyName)
at Smocks.AppDomains.AssemblyResolver.OnAssemblyResolve(Object sender, ResolveEventArgs args)
at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName) at Smocks.AppDomains.AppDomainContext.InvokeLambda[T](SerializableLambda1 serializableLambda, Object[] arguments) at Smocks.AppDomains.AppDomainContext.InvokeSerializableLambda[T](SerializableLambda
1 serializableFunc, Object target, Object[] arguments)
at Smocks.AppDomains.AppDomainContext.Invoke[T](Action1 action, T parameter) at Smocks.Smock.RunAction(Action
1 action, Configuration configuration)
at Smocks.Smock.Run(Configuration configuration, Action1 action) at Smocks.Smock.Run(Action
1 action)
Happens for me when I try mocking DateTime.Now
and DateTime.Today
in combination with netstandard 2.0.