Getting exceptions like object used after being disposed, NullReference while upload to Amazon.S3 - amazon-s3

I have a code which reads file in stream and uploads it to amazon S3. I used Amazon .net SDK for Monotouch and Mono for Android which internally where Amazon SDK AssemblyVersion("1.5.2.1")
which is working fine.
But sometimes following exceptions are thrown while upload:
Message = The object was used after being disposed.;
StackTrace = at System.Net.WebConnection.BeginWrite (System.Net.HttpWebRequest request, System.Byte[] buffer, Int32 offset, Int32 size, System.AsyncCallback cb, System.Object state) [0x00000] in <filename unknown>:0
at System.Net.WebConnectionStream.BeginWrite (System.Byte[] buffer, Int32 offset, Int32 size, System.AsyncCallback cb, System.Object state) [0x00000] in <filename unknown>:0
Message = Object reference not set to an instance of an object;
StackTrace = at System.ServiceModel.Dispatcher.BaseMessagesFormatter.DeserializeReply (System.ServiceModel.Channels.Message message, System.Object[] parameters) [0x00000] in <filename unknown>:0
at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request (System.ServiceModel.Description.OperationDescription od, System.Object[] parameters) [0x00000] in <filename unknown>:0
at System.ServiceModel.MonoInternal.ClientRuntimeChannel.DoProcess (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters) [0x00000] in <filename unknown>:0
at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Process (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters) [0x00000] in <filename unknown>:0
I've NOT set file stream = null or dispose for file stream being uploaded any where in code.
Found similar problem explained here
the line where I get exception, it tries to upload the given stream to s3.
More detailed explanation http://forums.xamarin.com/discussion/27098/getting-exceptions-like-object-used-after-being-disposed-nullreference-while-upload-to-amazon-s3
Some more stack traces:
--
UploadUsingHighLevelAPI; Message = Object reference not set to an instance of an object;
StackTrace = at System.Xml.XmlInputStream.Initialize (System.IO.Stream stream) [0x00000] in <filename unknown>:0
at System.Xml.XmlInputStream..ctor (System.IO.Stream stream) [0x00000] in <filename unknown>:0
at System.Xml.XmlStreamReader..ctor (System.IO.Stream input) [0x00000] in <filename unknown>:0
at System.Xml.XmlTextReader..ctor (System.IO.Stream input) [0x00000] in <filename unknown>:0
at Amazon.S3.AmazonS3Client.transform (System.String responseBody, System.String actionName, System.Type t) [0x00000] in <filename unknown>:0
at Amazon.S3.AmazonS3Client.processRequestError (System.String actionName, System.Net.HttpWebRequest request, System.Net.WebException we, System.Net.HttpWebResponse errorResponse, System.String requestAddr, System.Net.WebHeaderCollection& respHdrs, System.Type t, System.Exception& cause) [0x00000] in <filename unknown>:0
at Amazon.S3.AmazonS3Client.handleHttpWebErrorResponse (Amazon.S3.Model.S3Request userRequest, System.Net.WebException we, System.Net.HttpWebRequest request, System.Net.HttpWebResponse httpResponse, System.Exception& cause, System.Net.HttpStatusCode& statusCode) [0x00000] in <filename unknown>:0
at Amazon.S3.AmazonS3Client.getResponseCallback[PutObjectResponse] (IAsyncResult result) [0x00000] in <filename unknown>:0
--
UploadUsingHighLevelAPI; Message = Error: SendFailure (Error writing headers);
StackTrace = at System.Net.HttpWebRequest.EndGetRequestStream (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.Net.HttpWebRequest.GetRequestStream () [0x00000] in <filename unknown>:0
at Amazon.S3.AmazonS3Client.getRequestStreamCallback[PutObjectResponse] (IAsyncResult result) [0x00000] in <filename unknown>:0

Related

dotconnect for postgres - Unknown parameter direction

I have problem with PgSqlCommandBuilder.DeriveParameters function. Sometimes it throws an exception “Unknown parameter direction.” without any visible reason. Problem occurs quite rarely. When I get a first exception, it throws always for all subsequent calls until. After restart of my app, it works properly. I have version 6.8.322. Have, anyone similar problem ? I try fight with it for some time but without success.
full stack trace
System.Exception: Unknown parameter direction.
at Devart.Data.PostgreSql.l.a (System.Data.Common.DbConnection A_0, System.String[] A_1) [0x00000] in <filename unknown>:0
at Devart.Data.PostgreSql.l.a (System.Data.Common.DbConnection A_0, Devart.Common.DbConnectionInternal A_1, System.String A_2, System.String[] A_3) [0x00000] in <filename unknown>:0
at Devart.Common.DbConnectionInternal.a (Devart.Common.DbConnectionBase A_0, System.String A_1, System.String[] A_2) [0x00000] in <filename unknown>:0
at Devart.Common.DbConnectionBase.GetSchema (System.String collectionName, System.String[] restrictionValues) [0x00000] in <filename unknown>:0
at Devart.Data.PostgreSql.PgSqlCommand.DescribeProcedure (System.String name) [0x00000] in <filename unknown>:0
at Devart.Common.DbCommandBase.CreateParameters () [0x00000] in <filename unknown>:0
at Devart.Data.PostgreSql.PgSqlCommand.c () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) Devart.Data.PostgreSql.PgSqlCommand:c ()
at Devart.Data.PostgreSql.PgSqlCommandBuilder.DeriveParameters (Devart.Data.PostgreSql.PgSqlCommand command) [0x00000] in <filename unknown>:0
at #Zs.#Ys.#Us (Devart.Data.PostgreSql.PgSqlCommand #Vs, System.Object[] #Ws) [0x00000] in <filename unknown>:0
at #Zs.#Ys.#Xs (System.String #Ms, #Ns #Ns, System.Object[] #Ac) [0x00000] in <filename unknown>:0 at Devart.Data.PostgreSql.l.a (System.Data.Common.DbConnection A_0, System.String[] A_1) [0x00000] in <filename unknown>:0
at Devart.Data.PostgreSql.l.a (System.Data.Common.DbConnection A_0, Devart.Common.DbConnectionInternal A_1, System.String A_2, System.String[] A_3) [0x00000] in <filename unknown>:0
at Devart.Common.DbConnectionInternal.a (Devart.Common.DbConnectionBase A_0, System.String A_1, System.String[] A_2) [0x00000] in <filename unknown>:0
at Devart.Common.DbConnectionBase.GetSchema (System.String collectionName, System.String[] restrictionValues) [0x00000] in <filename unknown>:0
at Devart.Data.PostgreSql.PgSqlCommand.DescribeProcedure (System.String name) [0x00000] in <filename unknown>:0
at Devart.Common.DbCommandBase.CreateParameters () [0x00000] in <filename unknown>:0
at Devart.Data.PostgreSql.PgSqlCommand.c () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) Devart.Data.PostgreSql.PgSqlCommand:c ()
at Devart.Data.PostgreSql.PgSqlCommandBuilder.DeriveParameters (Devart.Data.PostgreSql.PgSqlCommand command) [0x00000] in <filename unknown>:0
at #Zs.#Ys.#Us (Devart.Data.PostgreSql.PgSqlCommand #Vs, System.Object[] #Ws) [0x00000] in <filename unknown>:0
at #Zs.#Ys.#Xs (System.String #Ms, #Ns #Ns, System.Object[] #Ac) [0x00000] in <filename unknown>:0
SQL
SELECT pr.proname as name,
TYPNS.nspname AS Schema,
TYP.typname as ReturnType,
proargtypes as InParams,
pr.oid as FunctionOID,
proallargtypes as OutParams,
proargmodes as ArgumentModes,
proargnames as ArgumentNames
FROM pg_proc pr
JOIN pg_namespace TYPNS ON TYPNS.oid = pr.pronamespace
LEFT OUTER JOIN pg_type TYP ON TYP.oid = prorettype
WHERE proisagg = FALSE
AND TYPNS.nspname like E'%'
AND pr.proname like E'gethostslimit'
AND pg_get_userbyid(proowner)::varchar like E'%'
AND TYP.typname like E'%'
AND pr.oid = E'28444'
ORDER BY proname, FunctionOID;
RETURN
"name";"schema";"returntype";"inparams";"functionoid";"outparams";"argumentmodes";"argumentnames"
"gethostslimit";"public";"record";"2950";28444;"{2950,23,23}";"{i,o,o}";"{sessionuidparam,exitcode,hostslimit}"
This topic is discussed on Devart forums http://forums.devart.com/viewtopic.php?t=30006

key dumplication when adding: httpmodules

I am getting this error (it appears) when mod_mono auto restarts.Really need your help.
System.ArgumentException: Key duplication when adding: httpModules
at System.Collections.Hashtable.PutImpl (System.Object key, System.Object value, Boolean overwrite) [0x00000] in <filename unknown>:0
at System.Collections.Hashtable.Add (System.Object key, System.Object value) [0x00000] in <filename unknown>:0
at System.Collections.Specialized.NameObjectCollectionBase.BaseAdd (System.String name, System.Object value) [0x00000] in <filename unknown>:0
at System.Collections.Specialized.NameObjectCollectionBase.BaseSet (System.String name, System.Object value) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationSectionCollection.get_Item (System.String name) [0x00000] in <filename unknown>:0
at System.Configuration.Configuration.GetSection (System.String path) [0x00000] in <filename unknown>:0
at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName, System.String path, System.Web.HttpContext context) [0x00000] in <filename unknown>:0
at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName, System.String path) [0x00000] in <filename unknown>:0
at System.Web.Configuration.WebConfigurationManager.GetWebApplicationSection (System.String sectionName) [0x00000] in <filename unknown>:0
at System.Web.HttpApplication.InitOnce (Boolean full_init) [0x00000] in <filename unknown>:0
I add as the first item below the entry in my web.config, and it's still happening.
Please help me.

Issues with installing Orchard & Mono

I am currently running an Ubuntu Server 12.10.
I tried to install Orchard along with mono. When i try to start mono :
MONO_IOMAP=all xsp4
I get the following errors in the CLI:
Handling exception type ConfigurationErrorsException
Message is No factory for host (/home/shto/sites/test/Orchard/Web.config line 13)
IsTerminating is set to True
System.Configuration.ConfigurationErrorsException: No factory for host (/home/shto/sites/test/Orchard/Web.config line 13)
Server stack trace:
at System.Configuration.ConfigInfo.ThrowException (System.String text, System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
at System.Configuration.SectionGroupInfo.ReadRemoveSection (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
at System.Configuration.SectionGroupInfo.ReadConfig (System.Configuration.Configuration cfg, System.String streamName, System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
at System.Configuration.SectionGroupInfo.ReadConfig (System.Configuration.Configuration cfg, System.String streamName, System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
at System.Configuration.Configuration.ReadConfigFile (System.Xml.XmlReader reader, System.String fileName) [0x00000] in <filename unknown>:0
at System.Configuration.Configuration.Load () [0x00000] in <filename unknown>:0
at System.Configuration.Configuration.Init (IConfigSystem system, System.String configPath, System.Configuration.Configuration parent) [0x00000] in <filename unknown>:0
at System.Configuration.Configuration..ctor (System.Configuration.InternalConfigurationSystem system, System.String locationSubPath) [0x00000] in <filename unknown>:0
at System.Configuration.InternalConfigurationFactory.Create (System.Type typeConfigHost, System.Object[] hostInitConfigurationParams) [0x00000] in <filename unknown>:0
at System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration (System.String path, System.String site, System.String locationSubPath, System.String server, System.String userName, System.String password, Boolean fweb) [0x00000] in <filename unknown>:0
Exception rethrown at [0]:
at (wrapper xdomain-invoke) System.AppDomain:DoCallBack (System.CrossAppDomainDelegate)
at (wrapper remoting-invoke-with-check) System.AppDomain:DoCallBack (System.CrossAppDomainDelegate)
at System.Web.Hosting.ApplicationHost.CreateApplicationHost (System.Type hostType, System.String virtualDir, System.String physicalDir) [0x00000] in <filename unknown>:0
at Mono.WebServer.VPathToHost.CreateHost (Mono.WebServer.ApplicationServer server, Mono.WebServer.WebSource webSource) [0x00000] in <filename unknown>:0
at Mono.WebServer.XSP.Server.RealMain (System.String[] args, Boolean root, IApplicationHost ext_apphost, Boolean quiet) [0x00000] in <filename unknown>:0
at Mono.WebServer.XSP.Server.Main (System.String[] args) [0x00000] in <filename unknown>:0
When i installed mono i used the command: apt-get install mono-complete
Orchard currently does not run in Mono.

Embedded mono + app.config

I have embedded mono in a c++ program and loaded a dll which requires an app.config. I am getting this kind of error, does someone have an idea on how to ship *.config with an embedded mono ?
The stack trace :
System.Configuration.ConfigurationErrorsException: Error Initializing the configuration system. ---> System.ArgumentException: The 'ExeConfigFilename' argument cannot be null.
at System.Configuration.ExeConfigurationHost.CheckFileMap (ConfigurationUserLevel level, System.Configuration.ExeConfigurationFileMap map) [0x00000] in <filename unknown>:0
at System.Configuration.ExeConfigurationHost.InitForConfiguration (System.String& locationSubPath, System.String& configPath, System.String& locationConfigPath, IInternalConfigRoot root, System.Object[] hostInitConfigurationParams) [0x00000] in <filename unknown>:0
at System.C[] hostInitConfigurationParams) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationManager.OpenExeConfigurationInternal (ConfigurationUserLevel userLevel, System.Reflection.Assembly calling_assembly, System.String exePath) [0x00000] in <filename unknown>:0
at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x00000] in <filename unknown>:0 onfiguration.InternalConfigurationSystem.InitForConfiguration (System.String& locationConfigPath, System.String& parentConfigPath, System.String& parentLocationConfigPath) [0x00000] in <filename unknown>:0
at System.Configuration.Configuration..ctor (System.Configuration.InternalConfigurationSystem system, System.String locationSubPath) [0x00000] in <filename unknown>:0
at System.Configuration.InternalConfigurationFactory.Create (System.Type typeConfigHost, System.Object
Self answer : you can't (as of 2013-04-30). To enable this behaviour, I had to change mono's framework sources mono/mcs/class/corlib/system/appdomain.cs :
public AppDomainSetup SetupInformation {
get {
return SetupInformationNoCopy; // newline
// AppDomainSetup setup = getSetup (); //old
// return new AppDomainSetup (setup); //old
}
}

Monodevelop: InvalidCastException when adding Web Reference using local WSDL

I am trying to add a Web Reference, using local WSDL/XSD files.
Unfortunately whenever I try, I get the exception below:
Am I doing something wrong?
It works with online web services.
Here is the full exception:
System.InvalidCastException: Cannot cast from source type to destination type.
at System.Xml.Serialization.XmlSchemaImporter.CollectAttributeUsesNonOverlap (System.Xml.Schema.XmlSchemaObjectCollection src, System.Xml.Serialization.ClassMap map) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSchemaImporter.ImportAttributes (System.Xml.XmlQualifiedName typeQName, System.Xml.Serialization.ClassMap cmap, System.Xml.Schema.XmlSchemaObjectCollection atts, System.Xml.Schema.XmlSchemaAnyAttribute anyat, System.Xml.Serialization.CodeIdentifiers classIds) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSchemaImporter.ImportMembersMappingComposite (System.Xml.Schema.XmlSchemaComplexType stype, System.Xml.XmlQualifiedName refer) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSchemaImporter.ImportMembersMapping (System.Xml.XmlQualifiedName name) [0x00000] in <filename unknown>:0
at System.ServiceModel.Description.XmlSerializerMessageContractImporterInternal.ImportPartsBySchemaElement (System.Xml.XmlQualifiedName qname, System.Collections.Generic.List`1 parts, System.Web.Services.Description.Message msg, System.Web.Services.Description.MessagePart msgPart) [0x00000] in <filename unknown>:0
at System.ServiceModel.Description.MessageContractImporterInternal.resolveMessage (System.Web.Services.Description.Message msg, System.ServiceModel.Description.MessageBodyDescription body, System.Collections.Generic.List`1 parts) [0x00000] in <filename unknown>:0
at System.ServiceModel.Description.MessageContractImporterInternal.DoImportContract () [0x00000] in <filename unknown>:0
at System.ServiceModel.Description.MessageContractImporterInternal.ImportContract (System.ServiceModel.Description.WsdlImporter importer, System.ServiceModel.Description.WsdlContractConversionContext context) [0x00000] in <filename unknown>:0
at System.ServiceModel.Description.XmlSerializerMessageContractImporter.System.ServiceModel.Description.IWsdlImportExtension.ImportContract (System.ServiceModel.Description.WsdlImporter importer, System.ServiceModel.Description.WsdlContractConversionContext context) [0x00000] in <filename unknown>:0
at System.ServiceModel.Description.WsdlImporter.ImportContract (System.Web.Services.Description.PortType wsdlPortType) [0x00000] in <filename unknown>:0
at System.ServiceModel.Description.WsdlImporter.ImportAllContracts () [0x00000] in <filename unknown>:0
at MonoDevelop.WebReferences.WCF.WebServiceDiscoveryResultWCF.CreateProxyFile (MonoDevelop.Projects.DotNetProject dotNetProject, FilePath basePath, System.String proxyNamespace, System.String referenceName) [0x00000] in <filename unknown>:0
at MonoDevelop.WebReferences.WebServiceDiscoveryResult.GenerateFiles (MonoDevelop.Projects.DotNetProject project, System.String namspace, System.String referenceName) [0x00000] in <filename unknown>:0
at MonoDevelop.WebReferences.Commands.WebReferenceCommandHandler.NewWebReference () [0x00000] in <filename unknown>:0
Same error with both Windows Communication Foundation (WCF) and .NET 2.0 Web Services.
File a bug report at bugzilla.xamarin.com (use "Class Libraries" / "WCF") and include the WSDL that you're trying to import.
From looking at that stack trace, Mono's WSDL importer doesn't like your import for some reason.