I recently added a new property to a base object that had a property with a
protected set. After adding the new propery to the class that inherited from
that class, I get the below error. This web service was working until this
change.
System.InvalidOperationException: Unable to generate a temporary class
(result=1).
error CS0272: The property or indexer 'USI.Data.Common.BizBase.IsValid'
cannot be used in this context because the set accessor is inaccessible
error CS0272: The property or indexer 'USI.Data.Common.BizBase.IsValid'
cannot be used in this context because the set accessor is inaccessible
at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns,
CompilerParameters parameters, Evidence evidence)
at System.Xml.Serialization.TempAssembly.GenerateAsse mbly(XmlMapping[]
xmlMappings, Type[] types, String defaultNamespace, Evidence evidence,
CompilerParameters parameters, Assembly assembly, Hashtable assemblies)
at System.Xml.Serialization.TempAssembly..ctor(XmlMap ping[] xmlMappings,
Type[] types, String defaultNamespace, String location, Evidence evidence)
at System.Xml.Serialization.XmlSerializer.FromMapping s(XmlMapping[]
mappings, Evidence evidence)
at
System.Web.Services.Protocols.XmlReturn.GetInitial izers(LogicalMethodInfo[]
methodInfos)
at
System.Web.Services.Protocols.XmlReturnWriter.GetI nitializers(LogicalMethodInfo[]
methodInfos)
at System.Web.Services.Protocols.MimeFormatter.GetIni tializers(Type type,
LogicalMethodInfo[] methodInfos)
at System.Web.Services.Protocols.HttpServerType..ctor (Type type)
at System.Web.Services.Protocols.HttpServerProtocol.I nitialize()
at System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type,
HttpContext context, HttpRequest request, HttpResponse response, Boolean&
abortProcessing)
Here is a simplified version of the code :
[XmlIgnore(), SoapIgnore()]
public override bool IsValid {
get {
return true;
}
protected set {
//throw new Exception("The method or operation is not
implemented.");
}
}
As you can see I tried adding the xmlignore and the soapignore properties to
no avail. I have to override the IsValid because it is abstract as well.