Possiedo un'applicazione Silverlight che recupera un elenco di classi serializzabili. In queste classi ci sono altre classi serializzabili alcune delle quali sono anche in una lista. Il problema è che tutto funziona fino a quando non compilo uno degli elenchi di classi serializzabili che provocano l'eccezione dell'argomento "Il server remoto ha restituito un errore: NotFound"Silverlight Webservice "Il server remoto ha restituito un errore: NotFound"
Questo è il codice che riempie la classe (Don ' t intimidire dalla grande quantità di codice è solo riempire la classe con le informazioni):
private SCharacter getSCharacter(Character userCharacter)
{
var iqcb = userCharacter.CharacterBodies;
var iqcs = userCharacter.CharacterStats;
var iqgs = userCharacter.CharacterSettings;
var iqcp = userCharacter.CharacterPoints;
var iqcproj = userCharacter.CharacterProjectiles;
var currChar =
new SCharacter
{
characterID = userCharacter.characterID,
characterName = userCharacter.characterName,
characterClassID = userCharacter.characterClassID,
userUsername = userCharacter.userUsername
};
foreach (var cb in iqcb)
{
var scb = new SCharacterBody();
scb.body.bodyId = cb.bodyId;
scb.body.bodyName = cb.Body.bodyName;
scb.bodyPart.bodyPartId = cb.BodyPart.bodyPartId;
scb.bodyPart.bodyPartName = cb.BodyPart.bodyPartName;
currChar.characterBodyList.Add(scb);
}
foreach (var cs in iqcs)
{
var scs =
new SCharacterStat
{
characterID = cs.characterID,
statId = cs.statId,
characterStatId = cs.characterStatId,
statName = cs.Stat.statName,
statValue = cs.statValue
};
currChar.characterStatList.Add(scs);
}
foreach (var igs in iqgs)
{
var scs = new SCharacterSetting
{
characterID = igs.characterID,
modifierId = igs.GameSetting.modifierId,
modifierType = igs.GameSetting.Modifier.modifierType,
characterSettingId = igs.characterSettingId,
settingDescription = igs.GameSetting.settingDescription,
settingName = igs.GameSetting.settingName,
settingValue = igs.GameSetting.settingValue
};
var gss = igs.GameSetting.Stat;
scs.stat.statId = gss.statId;
scs.stat.statName = gss.statName;
currChar.characterSettingList.Add(scs);
}
foreach (var cp in iqcp)
{
var scp = new SCharacterPoint
{
characterID = cp.characterID,
characterPointsId = cp.characterPointsId,
pointsId = cp.pointsId,
pointsName = cp.Point.pointsName,
pointsValue = cp.pointsValue
};
currChar.characterPointList.Add(scp);
}
foreach (var cp in iqcproj)
{
var scp =
new SCharacterProjectile
{
characterId = cp.characterId,
characterProjectileId = cp.characterProjectileId,
particleId = cp.Projectile.particleId,
projectileHeight = cp.Projectile.projectileHeight,
projectileWidth= cp.Projectile.projectileWidth,
damageId =cp.Projectile.damageId,
damageDuration = cp.Projectile.Damage.damageDuration,
damageValue = cp.Projectile.Damage.damageValue,
projectileName = cp.Projectile.projectileName
};
scp.force.forceName = cp.Projectile.forceName;
scp.force.impulseX = (float)cp.Projectile.Force.impulseX;
scp.force.impulseY = (float)cp.Projectile.Force.impulseY;
scp.force.torque = (float)cp.Projectile.Force.torque;
scp.projectileParticle.particleId = cp.Projectile.particleId;
scp.projectileParticle.particleName = cp.Projectile.Particle.particleName;
foreach (var psv in cp.Projectile.Particle.ParticleSettingValues)
{
var spsv = new SParticleSettingValue();
spsv.particleId = psv.particleId;
spsv.particleSettingID = psv.particleSettingID;
spsv.particleSettingName = psv.ParticleSetting.particleSettingName;
spsv.particleSettingValue = psv.particleSettingValue1;
spsv.particleSettingValuesID = psv.particleSettingValueID;
scp.projectileParticle.particleSettingList.Add(spsv);
}
foreach (var pc in cp.Projectile.Particle.ParticleColours)
{
var spc = new SParticleColour();
spc.colourHex = pc.colourHex;
spc.particleColourId = pc.particleColourId;
spc.particleId = pc.particleId;
scp.projectileParticle.particleColourList.Add(spc);
}
currChar.projectileList.Add(scp);
}
return currChar;
}
Nelle ultime 3 righe di codice c'è currChar.projectileList.Add(scp);
, se tolgo questa riga di codice tutto funziona bene. Quello che pensavo potesse causare il problema sono riferimenti circoscrizionali, ma ho controllato le classi e non riesco a trovarne. Se necessario sarò incollare il codice delle classi che hanno a che fare con projectileList
Aggiornamento: Ho cercato di eseguire il debug del webservice stesso e a quanto pare c'è un problema con la serializzazione XML, è possibile trovare la domanda here
Grazie! il problema che stavo avendo era il risultato di una dll mancante che ho scoperto dopo aver seguito le istruzioni sul link che hai fornito. –