Windows Vista Forums

XamlParseException -> System.Security exception
  1. #1


    Thomas W. Brown Guest

    XamlParseException -> System.Security exception

    I must be missing something obvious... I just installed VS 2008 on a new
    laptop (running XP SP3) and am trying the most simple WPF application
    (dropping a button onto the default grid. When I try to run I get an
    XamlParseException error (Line 1, position 9) but the inner, inner exception
    is a security exception:

    {"Request for the permission of type
    'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0,
    Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."}

    The stack trace is coming up through
    System.Windows.Markup.BamlRecordReader.CreateInstanceFromType

    Is there some .NET Security configuration I've missed? The weird thing is
    that on another machine I have no such problems and the .NET security
    configuration on both appears to be the same.

    TIA
    -- TB




      My System SpecsSystem Spec

  2. #2


    xYrus Guest

    Re: XamlParseException -> System.Security exception

    Could you try to upgrade to .NET 3.5
    (http://www.microsoft.com/downloads/d...displaylang=en)
    and try again?

    Ususally, you don't have to configure security parameters. But note that,
    when you do some local system action (e.g. deleting a file) in browser
    applications, you will get a security error.

    You can also get extended information about XAML parsing errory by executing
    the project via "F11" key (debug per line) and press F11 until the exception
    arrives. The highlighted line causes the error.

    If nothing helps, you could send me the sample code (e-mail in header) and I
    will check that in a new XPSP3 virtual machine.

    "Thomas W. Brown" <thomas_w_brown@xxxxxx> schrieb im
    Newsbeitrag news:3600C6A9-D357-4C83-9912-3381937D6740@xxxxxx

    >I must be missing something obvious... I just installed VS 2008 on a new
    > laptop (running XP SP3) and am trying the most simple WPF application
    > (dropping a button onto the default grid. When I try to run I get an
    > XamlParseException error (Line 1, position 9) but the inner, inner
    > exception
    > is a security exception:
    >
    > {"Request for the permission of type
    > 'System.Security.Permissions.SecurityPermission, mscorlib,
    > Version=2.0.0.0,
    > Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."}
    >
    > The stack trace is coming up through
    > System.Windows.Markup.BamlRecordReader.CreateInstanceFromType
    >
    > Is there some .NET Security configuration I've missed? The weird thing is
    > that on another machine I have no such problems and the .NET security
    > configuration on both appears to be the same.
    >
    > TIA
    > -- TB
    >

      My System SpecsSystem Spec

  3. #3


    Thomas W. Brown Guest

    Re: XamlParseException -> System.Security exception

    Already using .NET 3.5 -- I've installed VS2008. I checked anyway, and the
    installer confirmed that I already have it.

    The code is so simple it's not worth sending. Create a new WPF application
    in VS 2008, drag a button onto the grid, press F5 to run.

    On one machine, that I've had for awhile, and it has had VS 2003, VS 2005,
    and now VS 2008, this works just fine. On my new laptop, with only VS 2008,
    I get the error below. Both machines are running XP SP3.

    -- TB

    "xYrus" wrote:

    > Could you try to upgrade to .NET 3.5
    > (http://www.microsoft.com/downloads/d...displaylang=en)
    > and try again?
    >
    > Ususally, you don't have to configure security parameters. But note that,
    > when you do some local system action (e.g. deleting a file) in browser
    > applications, you will get a security error.
    >
    > You can also get extended information about XAML parsing errory by executing
    > the project via "F11" key (debug per line) and press F11 until the exception
    > arrives. The highlighted line causes the error.
    >
    > If nothing helps, you could send me the sample code (e-mail in header) and I
    > will check that in a new XPSP3 virtual machine.
    >
    > "Thomas W. Brown" <thomas_w_brown@xxxxxx> schrieb im
    > Newsbeitrag news:3600C6A9-D357-4C83-9912-3381937D6740@xxxxxx

    > >I must be missing something obvious... I just installed VS 2008 on a new
    > > laptop (running XP SP3) and am trying the most simple WPF application
    > > (dropping a button onto the default grid. When I try to run I get an
    > > XamlParseException error (Line 1, position 9) but the inner, inner
    > > exception
    > > is a security exception:
    > >
    > > {"Request for the permission of type
    > > 'System.Security.Permissions.SecurityPermission, mscorlib,
    > > Version=2.0.0.0,
    > > Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."}
    > >
    > > The stack trace is coming up through
    > > System.Windows.Markup.BamlRecordReader.CreateInstanceFromType
    > >
    > > Is there some .NET Security configuration I've missed? The weird thing is
    > > that on another machine I have no such problems and the .NET security
    > > configuration on both appears to be the same.
    > >
    > > TIA
    > > -- TB
    > >
    >

      My System SpecsSystem Spec

  4. #4


    Thomas W. Brown Guest

    Re: XamlParseException -> System.Security exception

    One slight clarification... There is actually another InnerException
    available, with a slightly different stack trace:

    at System.Security.CodeAccessSecurityEngine.Check(Object demand,
    StackCrawlMark& stackMark, Boolean isPermSet)
    at System.Security.CodeAccessPermission.Demand()
    at MS.Internal.PresentationFramework.SecurityHelper.DemandUnmanagedCode()
    at System.Windows.Window..ctor()
    at Test.Window1..ctor()

    Perhaps this helps shed some light on this issue??

    -- TB

    "xYrus" wrote:

    > Could you try to upgrade to .NET 3.5
    > (http://www.microsoft.com/downloads/d...displaylang=en)
    > and try again?
    >
    > Ususally, you don't have to configure security parameters. But note that,
    > when you do some local system action (e.g. deleting a file) in browser
    > applications, you will get a security error.
    >
    > You can also get extended information about XAML parsing errory by executing
    > the project via "F11" key (debug per line) and press F11 until the exception
    > arrives. The highlighted line causes the error.
    >
    > If nothing helps, you could send me the sample code (e-mail in header) and I
    > will check that in a new XPSP3 virtual machine.
    >
    > "Thomas W. Brown" <thomas_w_brown@xxxxxx> schrieb im
    > Newsbeitrag news:3600C6A9-D357-4C83-9912-3381937D6740@xxxxxx

    > >I must be missing something obvious... I just installed VS 2008 on a new
    > > laptop (running XP SP3) and am trying the most simple WPF application
    > > (dropping a button onto the default grid. When I try to run I get an
    > > XamlParseException error (Line 1, position 9) but the inner, inner
    > > exception
    > > is a security exception:
    > >
    > > {"Request for the permission of type
    > > 'System.Security.Permissions.SecurityPermission, mscorlib,
    > > Version=2.0.0.0,
    > > Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."}
    > >
    > > The stack trace is coming up through
    > > System.Windows.Markup.BamlRecordReader.CreateInstanceFromType
    > >
    > > Is there some .NET Security configuration I've missed? The weird thing is
    > > that on another machine I have no such problems and the .NET security
    > > configuration on both appears to be the same.
    > >
    > > TIA
    > > -- TB
    > >
    >

      My System SpecsSystem Spec

  5. #5


    Thomas W. Brown Guest

    Re: XamlParseException -> System.Security exception

    Here's the XAML, the code-behind is all default generated by VS2008; I
    haven't modified a thing:

    <Window x:Class="Test.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid>
    <Button Margin="98,115,105,125" Name="button1">Hello, World!</Button>
    </Grid>
    </Window>



    "xYrus" wrote:

    > Could you try to upgrade to .NET 3.5
    > (http://www.microsoft.com/downloads/d...displaylang=en)
    > and try again?
    >
    > Ususally, you don't have to configure security parameters. But note that,
    > when you do some local system action (e.g. deleting a file) in browser
    > applications, you will get a security error.
    >
    > You can also get extended information about XAML parsing errory by executing
    > the project via "F11" key (debug per line) and press F11 until the exception
    > arrives. The highlighted line causes the error.
    >
    > If nothing helps, you could send me the sample code (e-mail in header) and I
    > will check that in a new XPSP3 virtual machine.
    >
    > "Thomas W. Brown" <thomas_w_brown@xxxxxx> schrieb im
    > Newsbeitrag news:3600C6A9-D357-4C83-9912-3381937D6740@xxxxxx

    > >I must be missing something obvious... I just installed VS 2008 on a new
    > > laptop (running XP SP3) and am trying the most simple WPF application
    > > (dropping a button onto the default grid. When I try to run I get an
    > > XamlParseException error (Line 1, position 9) but the inner, inner
    > > exception
    > > is a security exception:
    > >
    > > {"Request for the permission of type
    > > 'System.Security.Permissions.SecurityPermission, mscorlib,
    > > Version=2.0.0.0,
    > > Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."}
    > >
    > > The stack trace is coming up through
    > > System.Windows.Markup.BamlRecordReader.CreateInstanceFromType
    > >
    > > Is there some .NET Security configuration I've missed? The weird thing is
    > > that on another machine I have no such problems and the .NET security
    > > configuration on both appears to be the same.
    > >
    > > TIA
    > > -- TB
    > >
    >

      My System SpecsSystem Spec

  6. #6


    Thomas W. Brown Guest

    RE: XamlParseException -> System.Security exception

    Ok, enough detective work turned up the need, on this installation at least,
    to explicitly set the Security settings for this project to "Enable ClickOnce
    Security Settings" where the option for full trust application was already
    selected. Once I did this, I can run even the vanilla app created for a
    blank WPF Application in VS2008 without encountering the error.

    Still a mystery, though, is why, on my other machine, do I not need to do
    this? Why is the "WPF Application" wizard code, on my new laptop
    installation, trying to run in the sandbox? The project is set to build a
    Windows Application.

    -- TB

    "Thomas W. Brown" wrote:

    > I must be missing something obvious... I just installed VS 2008 on a new
    > laptop (running XP SP3) and am trying the most simple WPF application
    > (dropping a button onto the default grid. When I try to run I get an
    > XamlParseException error (Line 1, position 9) but the inner, inner exception
    > is a security exception:
    >
    > {"Request for the permission of type
    > 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0,
    > Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."}
    >
    > The stack trace is coming up through
    > System.Windows.Markup.BamlRecordReader.CreateInstanceFromType
    >
    > Is there some .NET Security configuration I've missed? The weird thing is
    > that on another machine I have no such problems and the .NET security
    > configuration on both appears to be the same.
    >
    > TIA
    > -- TB
    >

      My System SpecsSystem Spec

  7. #7


    Thomas W. Brown Guest

    RE: XamlParseException -> System.Security exception

    O...M...G...,

    Ok, I finally realized that this laptop was setup to redirect "My Documents"
    to a mapped network drive. So, the default location for new projects was on
    a network share instead of the local hard drive. I was essentially getting
    the same error one gets when trying to run a .NET Forms application from a
    network share, just very much disguised!!!

    It will be nice to see the next round of improvements in the IDE for working
    with XAML and WPF projects!!!!!!!

    -- TB

    "Thomas W. Brown" wrote:

    > I must be missing something obvious... I just installed VS 2008 on a new
    > laptop (running XP SP3) and am trying the most simple WPF application
    > (dropping a button onto the default grid. When I try to run I get an
    > XamlParseException error (Line 1, position 9) but the inner, inner exception
    > is a security exception:
    >
    > {"Request for the permission of type
    > 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0,
    > Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."}
    >
    > The stack trace is coming up through
    > System.Windows.Markup.BamlRecordReader.CreateInstanceFromType
    >
    > Is there some .NET Security configuration I've missed? The weird thing is
    > that on another machine I have no such problems and the .NET security
    > configuration on both appears to be the same.
    >
    > TIA
    > -- TB
    >

      My System SpecsSystem Spec

  8. #8


    maxima Guest

    RE: XamlParseException -> System.Security exception

    I had similar problem. Installed VS2008 and made a little test app with few
    buttons. I had same exception - line 1 character 9 thingy.

    I started to comment out C# code line by line and then found that some very
    simple code in Windows1 constructor was the cause of the exception in
    run-time.

    I had to move it into OnIntitalize and it works since that. I still dont
    know why it was heppening though as the code did compile fine and looked
    pretty legitimate.

    I just wonder - how much real PITA this 'nice' separation (XAML from
    code-behind) is going to bring into development processes in big projects
    within big teams. Especially if 'designers' will be in charge of XAML and
    'developers' - of C# code-behind.



    "Thomas W. Brown" wrote:

    > O...M...G...,
    >
    > Ok, I finally realized that this laptop was setup to redirect "My Documents"
    > to a mapped network drive. So, the default location for new projects was on
    > a network share instead of the local hard drive. I was essentially getting
    > the same error one gets when trying to run a .NET Forms application from a
    > network share, just very much disguised!!!
    >
    > It will be nice to see the next round of improvements in the IDE for working
    > with XAML and WPF projects!!!!!!!
    >
    > -- TB
    >
    > "Thomas W. Brown" wrote:
    >

    > > I must be missing something obvious... I just installed VS 2008 on a new
    > > laptop (running XP SP3) and am trying the most simple WPF application
    > > (dropping a button onto the default grid. When I try to run I get an
    > > XamlParseException error (Line 1, position 9) but the inner, inner exception
    > > is a security exception:
    > >
    > > {"Request for the permission of type
    > > 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0,
    > > Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."}
    > >
    > > The stack trace is coming up through
    > > System.Windows.Markup.BamlRecordReader.CreateInstanceFromType
    > >
    > > Is there some .NET Security configuration I've missed? The weird thing is
    > > that on another machine I have no such problems and the .NET security
    > > configuration on both appears to be the same.
    > >
    > > TIA
    > > -- TB
    > >

      My System SpecsSystem Spec

  9. #9


    Thomas W. Brown Guest

    RE: XamlParseException -> System.Security exception

    I hear ya! I think we'll see the same trend as all other "ground-breaking"
    development paradigms coming out of Redmond... To my mind, MFC wasn't usable
    until v2.0, .NET was only barely usable at 1.1 and didn't become first class
    until 2.0, Windows itself didn't shine until Win98 (trust me on this, I was
    developing apps for Windows 1.04!!)...

    So, I'm not expecting any of the new stuff (LINQ, WCF and WPF) to really hit
    their stride until we get at least one major version underneath our belts.
    Even then, we'll have to see...

    Regards,
    -- TB

    "maxima" wrote:

    > I had similar problem. Installed VS2008 and made a little test app with few
    > buttons. I had same exception - line 1 character 9 thingy.
    >
    > I started to comment out C# code line by line and then found that some very
    > simple code in Windows1 constructor was the cause of the exception in
    > run-time.
    >
    > I had to move it into OnIntitalize and it works since that. I still dont
    > know why it was heppening though as the code did compile fine and looked
    > pretty legitimate.
    >
    > I just wonder - how much real PITA this 'nice' separation (XAML from
    > code-behind) is going to bring into development processes in big projects
    > within big teams. Especially if 'designers' will be in charge of XAML and
    > 'developers' - of C# code-behind.
    >
    >
    >
    > "Thomas W. Brown" wrote:
    >

    > > O...M...G...,
    > >
    > > Ok, I finally realized that this laptop was setup to redirect "My Documents"
    > > to a mapped network drive. So, the default location for new projects was on
    > > a network share instead of the local hard drive. I was essentially getting
    > > the same error one gets when trying to run a .NET Forms application from a
    > > network share, just very much disguised!!!
    > >
    > > It will be nice to see the next round of improvements in the IDE for working
    > > with XAML and WPF projects!!!!!!!
    > >
    > > -- TB
    > >
    > > "Thomas W. Brown" wrote:
    > >

    > > > I must be missing something obvious... I just installed VS 2008 on a new
    > > > laptop (running XP SP3) and am trying the most simple WPF application
    > > > (dropping a button onto the default grid. When I try to run I get an
    > > > XamlParseException error (Line 1, position 9) but the inner, inner exception
    > > > is a security exception:
    > > >
    > > > {"Request for the permission of type
    > > > 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0,
    > > > Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."}
    > > >
    > > > The stack trace is coming up through
    > > > System.Windows.Markup.BamlRecordReader.CreateInstanceFromType
    > > >
    > > > Is there some .NET Security configuration I've missed? The weird thing is
    > > > that on another machine I have no such problems and the .NET security
    > > > configuration on both appears to be the same.
    > > >
    > > > TIA
    > > > -- TB
    > > >

      My System SpecsSystem Spec

  10. #10


    maxima Guest

    RE: XamlParseException -> System.Security exception

    I started from punching cards for ibm 360 :-P

    perhaps we are too old to appreciate the 'real' beauty of wpf

    "Thomas W. Brown" wrote:

    > I hear ya! I think we'll see the same trend as all other "ground-breaking"
    > development paradigms coming out of Redmond... To my mind, MFC wasn't usable
    > until v2.0, .NET was only barely usable at 1.1 and didn't become first class
    > until 2.0, Windows itself didn't shine until Win98 (trust me on this, I was
    > developing apps for Windows 1.04!!)...

      My System SpecsSystem Spec

Page 1 of 2 12 LastLast
XamlParseException -> System.Security exception problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Backup Exception C:\windows\security\edb.log and tmp.edb Melina Baker Server General 0 31 Dec 2009
system service exception BSOD stirfriedsushi General Discussion 8 26 Jul 2009
.net security exception skitzsofrenick .NET General 2 16 Sep 2008
System Service Exception Robert W. Vista General 7 09 May 2008
Error loading system MshSnapIns exception from C# dll Varun Bansal PowerShell 4 26 May 2006