Silverlight 5 RC TypeLoadException - by Philippe Lécaillon

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


30
0
Sign in
to vote
ID 687371 Comments
Status Closed Workarounds
Type Bug Repros 21
Opened 9/6/2011 6:19:29 AM
Access Restriction Public

Description

When I try to create a wcf client with the ClientBase<TChannel> class, the InnerChannel throws an exception. The same code worked in sl4 and sl5 beta...

After investigation, It appears to be caused by the 'Require elevated trust' option. When it is check it fails.

See those 2 posts in the Silverlight forum. The first one is mine, the second is I think someone who has the same problem.

http://forums.silverlight.net/t/238185.aspx/1?Issue+with+WCF+client+in+SL5+RC
http://forums.silverlight.net/t/238126.aspx/1?TypeLoadException+in+MEF+SL5+RC



Sign in to post a comment.
Posted by jef06 on 10/25/2011 at 7:04 AM
I use this to get type and it seems to work for me add this in your own class

Try catch and if you get the exception try this way.

private static List<Assembly> GetLoadedAssemblies()        
{            
    List<Assembly> assemblies = new List<Assembly>();            
    foreach (AssemblyPart part in Deployment.Current.Parts)            
    {                
        StreamResourceInfo sri = Application.GetResourceStream(new Uri(part.Source, UriKind.Relative));                
        if (sri == null)                    
            continue;                
        Assembly assembly = new AssemblyPart().Load(sri.Stream);                
        if (assembly != null && !assemblies.Contains(assembly))                    
            assemblies.Add(assembly);            
    }            
    // Additional assemblies that are not found when examining of Deployment.Current.Parts above            
    Type[] types =            
    {                
        typeof(System.Windows.Application), // System.Windows.dll,                
    };            
    foreach (Type type in types)            
    {                
        Assembly assembly = type.Assembly;                
        if (assembly != null && !assemblies.Contains(assembly))                    
            assemblies.Add(assembly);            
    }            
    return assemblies;        
}

public static Type Resolve(string qualifiedTypeName)
{
    var typeName = qualifiedTypeName.Substring(qualifiedTypeName.IndexOf(':') + 1);

    var types =
        loadedAssemblies.Aggregate(new List<Type>(),
            (list, asm) =>
            {
                Type type = asm.GetType(typeName);
                if (type != null)
                {
                    list.Add(type);
                }
                return list;
            });
    return types.FirstOrDefault();
}

Regards.
Posted by lmdf on 10/14/2011 at 4:12 AM
This could be also reproduced in Silverlight RC.
Posted by Dan Jarvis on 10/7/2011 at 6:08 AM
Has there been any update with this? I see it marked as "closed" but the problem still exists with SL5RC.
Posted by wdl01 on 9/28/2011 at 12:33 AM
@Zodraz,
It is indeed not solved in RC, read te post!
The problem was introduced in de Beta to RC

@Sb87, I've added a beta version to this feedback item, see feedback details.
I totally agree with you about the actions which microsoft should do.
Posted by Zodraz on 9/28/2011 at 12:00 AM
Hi, this is not solved. It happens upgrading SL5 Beta to RC.
Posted by Steven Barnett on 9/27/2011 at 12:19 PM
Microsoft, please do one or both of the following:

1. Release a patch for this that will work with the release candidate.
2. Provide links to download the beta again, including the Mac developer runtime.

We cannot test our product properly without these happening.
Posted by wdl01 on 9/26/2011 at 3:35 AM
I've added the beta version to this item, see details.

Good luck!
Posted by bxyanks211 on 9/21/2011 at 7:39 AM
@wld01, is there any chance you could post that beta version somewhere for me? I can't find one anywhere; It would be greatly appreciated.
Posted by wdl01 on 9/20/2011 at 11:34 PM
I got lucky, found a beta version somewhere on my harddisk,
But a download to the beta version should be provided by microsoft, I cannot use the RC version.
Posted by Craigsn on 9/20/2011 at 10:08 AM
I agree with bxyanks211. We need to be able to get back to SL5 Beta until the RC is fixed or the released product is out. Or, until there is a work-around.

Thanks
Posted by bxyanks211 on 9/19/2011 at 12:51 PM
I also want to add that if I unchecked 'Elevated Trust Scenarios', I receive a EndpointNotFoundException - the service is unavailable for the protocol of the address. Considering I have this running on 6 machines with Silverlight 5 beta, I think this is also a RC problem as well. I wish I didn't delete the beta installation files...
Posted by bxyanks211 on 9/19/2011 at 11:59 AM
Is there anyway I can download Silverlight 5 beta again? All the links on the web have been replaced with the RC download. My company desperately needs the tool I wrote, but this is not possible with the RC. If I could get my hands on the beta SDK I could publish my tool asap. yanks551@optonline.net. Thanks in advance.
Posted by wdl01 on 9/18/2011 at 11:48 AM
" Note that this bug will be seen only in "Elevated Trust" scenarios. "

Correct, and the elevated trust is what I need :)

Do we have to wait for the release? or will there be a patch/fix or something?
Posted by Microsoft on 9/15/2011 at 2:40 PM
Thank you for reporting this issue. We have identified the bug and will be fixing it for the SL5 release.

This issue may lead to a TypeLoadException, MethodAccessException or TypeAccessException in "Elevated Trust" scenarios. Note that this bug will be seen only in "Elevated Trust" scenarios.

Thanks,
Arun Moorthy
Microsoft CLR Team
Posted by Fred_Sopra on 9/8/2011 at 2:52 AM
Same issue on a WCF web service using NetTcp binding and PollingDuplex. Working fine on SL4 and SL5 Beta but raise a TypeLoadException into the CookieContainer on SL 5 RC when OOB is activated and "Require elevated trust..." checked.
Working fine under SL5 RC if I Uncheck "Require elevated trust..." in OOB settings.
Posted by Jotabnu Flamengo on 9/7/2011 at 7:51 AM
When I update my SL5 Beta to SL5 RC, My application OOB do not work, the WCF communication get this error:

Inheritance security rules violated while overriding member: 'proxy_3.BeginPing(System.AsyncCallback, System.Object)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden

Occurs when I'm try connect to my WCF Service.
Posted by MS-Moderator07 [Feedback Moderator] on 9/6/2011 at 7:11 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Posted by MS-Moderator01 on 9/6/2011 at 6:41 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Posted by wdl01 on 9/6/2011 at 6:35 AM
My reaction on the forum, I believe it is a bug in sl5 rc

Yes indeed, it is the OOB require elevated trust option in Out-of-Browser Settings.
When I disable this option I do not get the TypeLoadException, only when i enable this option.

When I execute a domainservice load operation I alsow get this TypeLoadException
What causes the TypeLoadexception when i want to load a domainservice query?