.net在32位中“动态程序集中不支持”的问题

时间:2013-10-09 22:28:31

标签: .net wpf exception .net-assembly

我有一个应用程序是另一个商业应用程序的插件,我的所有代码都在.NET 4.0中。当显示特定对话框时,用户收到错误“动态程序集中不支持调用成员”。我已经研究了这一点,我发现它是在运行时或通过反射加载程序集的问题(正如错误所示。但是我的情况有两个奇怪的部分,我无法弄清楚:

  1. 这似乎只发生在32位操作系统上,而不是64位。
  2. 对话框非常简单,它有1个枚举,几个属性和一些事件处理程序。我没有看到任何调用任何应该创建它的东西。它看起来像是在调用'ShowDialog()'时抛出了错误,但是当窗口显示时,对话框中甚至没有处理程序。
  3. 代码如下(p.s.这是WPF,所以我包括了xaml和.vb代码。

        Public Class Dlg_ManualActivate
    
            Public Enum ActivateOptions
                Manual = 0
                Skip = 1
            End Enum
    
            Public Property ActivationKey As String
            Public Property ActivateOption As ActivateOptions = ActivateOptions.Skip
    
            Public ReadOnly Property ActivationString As String
                Get
                    Return "Activation Key:" & vbTab & ActivationKey & vbCrLf & "Computer ID:" & vbTab & Environment.MachineName
                End Get
            End Property
    
            Public Sub New(aKey As String)
    
                ' This call is required by the designer.
                InitializeComponent()
    
                ' Add any initialization after the InitializeComponent() call.
                ActivationKey = aKey
                DataContext = Me
            End Sub
    
            Private Sub btn_Email_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
                Dim msgString As String = "mailto:*myemail*"
                msgString += "?subject=Activation Request - Selection Master"
                msgString += "&body=Thank you for your interest in Selection Master.  Please send this email to receive your manual activation key.  "
                msgString += "Once your key is received you can paste it into the license activation dialog to activate your license.  Please do not "
                msgString += "modify the activation key or computer id or your manual activation key will not function.%0AActivation Key:%09%09" & ActivationKey & "%0A"
                msgString += "Computer ID:%09%09" & Environment.MachineName
                msgString = msgString.Replace(" ", "%20")
                Process.Start(msgString)
            End Sub
    
            Private Sub Btn_ManualActivation_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
                ActivateOption = ActivateOptions.Manual
                DialogResult = True
                Close()
            End Sub
    
            Private Sub Btn_Skip_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
                ActivateOption = ActivateOptions.Skip
                DialogResult = True
                Close()
            End Sub
    
            Private Sub Hyperlink_RequestNavigate(sender As System.Object, e As System.Windows.Navigation.RequestNavigateEventArgs)
                Process.Start(e.Uri.ToString)
            End Sub
        End Class
    

    XAML代码:

    <Window x:Class="Dlg_ManualActivate"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
            Title="Selection Master | Manual Activation"
            ResizeMode="NoResize"
           Width="478"
                 mc:Ignorable="d" d:DesignHeight="583" SizeToContent="Height" Icon="Images/Icon_SelectionMaster_64.png" WindowStartupLocation="CenterScreen">
        <Window.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="RDStyles.xaml" />
                </ResourceDictionary.MergedDictionaries>
                <Style TargetType="Button" BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" >
                    <Setter Property="Focusable" Value="False" />
                    <Setter Property="HorizontalAlignment" Value="Stretch" />
                    <Setter Property="VerticalAlignment" Value="Stretch" />
                    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                    <Setter Property="VerticalContentAlignment" Value="Stretch" />
                    <Setter Property="Margin" Value="8,4" />
                    <Setter Property="Cursor" Value="Hand" />
                    <Setter Property="Background" Value="White" />
                    <Setter Property="BorderBrush" Value="Silver" />
                    <Setter Property="BorderThickness" Value="1" />
                </Style>
            </ResourceDictionary>
        </Window.Resources>
        <Grid>
            <StackPanel>
                <Grid Background="{StaticResource br_Backdrop_Upper}">
                    <Grid Margin="5,2">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Image Source="Images/Icon_SelectionMaster_64.png" Margin="8,5" />
                        <StackPanel Grid.Column="1">
                            <TextBlock Text="Welcome to Selection Master" FontSize="20" FontWeight="Bold" TextWrapping="Wrap" Margin="0,3" Foreground="{StaticResource br_RDBlue}" />
                            <Separator Margin="0,0,20,0" />
                            <TextBlock Name="tb_Msg" Margin="10,2,10,10" Text="Your automatic activation was not able to be processed, possibly due to security measures blocking Selection Master from connecting to the license server." TextWrapping="Wrap" />
                        </StackPanel>
                    </Grid>
                </Grid>
                <Border Background="{StaticResource br_RDRed}" Margin="0" Padding="10,3">
                    <TextBlock Text="Please Activate Your License by following the steps below" Foreground="White" FontWeight="Bold" />
                </Border>
                <Grid Grid.IsSharedSizeScope="True">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <TextBlock Text="Request Activation Via Email" Style="{StaticResource st_TitleText}" Margin="8,8,8,2" />
                    <Separator Margin="8,-1" VerticalAlignment="Bottom" />
                    <TextBlock Margin="8,3" Grid.Row="1" TextWrapping="Wrap">You may request manual activation via email by emailing the information below to registration@revolutiondesign.biz.  This information will automatically be added if you use the 'Create Email' button below, or you can manually copy it into an email editor of your choice.</TextBlock>
                    <Grid Grid.Row="2">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <TextBlock Text="Activation Data" Style="{StaticResource st_TitleText}" Grid.ColumnSpan="2" Margin="8,8,8,2" />
                        <Separator Margin="8,-1" VerticalAlignment="Bottom" Grid.ColumnSpan="2" />
                        <TextBox Text="{Binding ActivationString, Mode=OneWay}" Grid.Row="1" Margin="8,8,4,4" />
                        <Button Grid.Column="1" Name="btn_Email" Click="btn_Email_Click" Grid.Row="1" Margin="4,8,8,4">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>
                                <Image Source="Images/Icon_Envelope.png" Margin="10,8,10,2" VerticalAlignment="Center" HorizontalAlignment="Center" />
                                <TextBlock Text="Create Email" Margin="5,2" Grid.Row="1" FontWeight="Bold" />
                            </Grid>
                        </Button>
                    </Grid>
                    <Button Grid.Row="3" Name="Btn_ManualActivation" Click="Btn_ManualActivation_Click">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <StackPanel Margin="3" Grid.Column="1">
                                <TextBlock Style="{StaticResource st_TitleText}" Text="Activate Manually" />
                                <Separator />
                                <TextBlock Text="Use this option when you have received a manual activation key from Revolution Design.  On the registration wizard that comes up, select 'Register' then switch to 'Manual Activation' and input the appropriate keys." TextWrapping="Wrap" Margin="10,0" />
                            </StackPanel>
                        </Grid>
                    </Button>
                    <Button Grid.Row="4" Name="Btn_Skip" Margin="8,4,8,8" Click="Btn_Skip_Click">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <StackPanel Margin="3" Grid.Column="1">
                                <TextBlock Style="{StaticResource st_TitleText}" Text="Skip to Standard Activation Options" />
                                <Separator />
                                <TextBlock Margin="10,0" Text="Use this option if you have purchased a key and wish to ignore the automatic activation data on your system." TextWrapping="Wrap" />
                            </StackPanel>
                        </Grid>
                    </Button>
                </Grid>
                <Separator Style="{StaticResource st_SeparatorRed}" Margin="0,-1" />
                <TextBlock Padding="8,4" Background="{StaticResource br_Backdrop_Lower}">
                    <Hyperlink RequestNavigate="Hyperlink_RequestNavigate" NavigateUri="http://www.revolutiondesign.biz/purchase.php">
                        <TextBlock Text="Purchase Selection Master" FontWeight="Bold" />
                    </Hyperlink>
                </TextBlock>
            </StackPanel>
        </Grid>
        </Window>
    

    以下是来自其计算机的错误堆栈的图像:

    error stack

0 个答案:

没有答案