Posted 16 years ago by Miha Markic - Righthand
Avatar
Hi guys,

DotNetProjectResolver fails to resolve System.Data.Linq system assembly even thoug the application is marked as full trust (in clickonce settings).
It throws: MethodAccessException: a..ctor().
Why are you creating instances from that assembly?
Note: the problematic assembly is not referenced by application - perhaps this is the problem?

Miha

Here is call stack:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(String assemblyName, String typeName)
at System.AppDomain.CreateInstance(String assemblyName, String typeName)
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName)
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName)
at ActiproSoftware.SyntaxEditor.Addons.DotNet.Dom.AssemblyCodeRepository.Add(String assemblyName, DotNetProjectResolver projectResolver)
at ActiproSoftware.SyntaxEditor.Addons.DotNet.Dom.DotNetProjectResolver.AddExternalReference(String assemblyName)
at ActiproSoftware.SyntaxEditor.Addons.DotNet.Dom.DotNetProjectResolver.AddExternalReferenceForSystemAssembly(String assemblyName)
at Aioss.Aps3.WinFormsClient.Program.LoadResolver()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

[Modified at 07/31/2008 08:55 AM]

[Modified at 07/31/2008 09:12 AM]

Miha Markic Righthand .net consulting and software development

Comments (3)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Miha,

It isn't creating anything in your assembly. That code is trying to create a ProjectContentLoader, which is an internal class in our assembly.

It sounds like it won't let the ProjectContentLoader's constructor be called properly. Any idea why?


Actipro Software Support

Posted 16 years ago by Miha Markic - Righthand
Avatar
Hi guys,

Is there a way to attach file to these posts?
I don't know why this is happening but I guess it has something to do with security.
Here is the repro. Create winforms project and place this code in Form1.cs:

protected override void OnLoad(EventArgs e)
{
    if (!DesignMode)
    {
        DotNetProjectResolver resolver = new DotNetProjectResolver();
        string path = Path.GetTempPath() + @"\Test";
        if (!Directory.Exists(path))
            Directory.CreateDirectory(path);
        resolver.CachePath = path;
        resolver.AddExternalReferenceForSystemAssembly("System.Data.Linq");
    }
    base.OnLoad(e);
}
Make sure you check Project Properties/Security/Enable ClickOnce Security Settings and run the sample.
You'll get this excetion on Add.. line. Note, this is happening only to assemblies not referenced by the project itself.

Miha Markic Righthand .net consulting and software development

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Thanks I think we found the problem. The AppDomainSetup we pass to create the AppDomain needed to pass some trust info along as well. When we do that it gets past your sample and displays the form ok. This will be in the next maintenance release.


Actipro Software Support

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.