0

I keep having this error within a line of my code and I can't seem to fix it.

  1. error BC30182: Type expected.
  2. error BC30638: Array bounds cannot appear in type specifiers.

Here is my code:

Dim upload As Dictionary(Of (Long, Long, Long), Long)

It is located in Page_Prerender . The LangVersion for :default, latest or 16.9 could not be set also. (the value 'default' is invalid for option 'langversion'). The error occurs in vs2019 and vs2022 community version. However it runs fine on LinqPad5 and other VB project. I deleted all my obj files and rebooted :(. Maybe I have to delete some other object files in appdata or elsewhere?

I tried to compile it in previous version of visual studio, deleted obj files, changed langversion.

  • When you're asking a question about an error, *always* give the precise error you're encountering, *in the question*. It's unclear what this has to do with asp.net and webforms, btw... you might want to clarify that. – Jon Skeet Oct 27 '22 at 09:29
  • Have you tried using `ValueTuple` explicitly, e.g. `Dictionary(Of ValueTuple(Long, Long, Long), Long)`? – Jon Skeet Oct 27 '22 at 09:30
  • Your existing code works for me: https://gist.github.com/jskeet/7a22d3ff204047fe1868ad8b9524823f I do wonder whether it *is* specific to webforms, due to that using an older version of VB. It would be easy to test that in a simpler way - can you use tuples *at all* in your webform? – Jon Skeet Oct 27 '22 at 09:33
  • I suspect that https://stackoverflow.com/questions/56130824 is basically what you need, but the VB equivalent. – Jon Skeet Oct 27 '22 at 09:34
  • that results in BC32093 'Of' required when specifying type arguments for a generic type or method. The valuetypes are just examples. Other tuples contain reference types – doctor boo Oct 27 '22 at 09:34
  • Again: can you use tuples *at all* in your webform? If it just turns out this is "you're using an older version of the language" then the link to the other Stack Overflow question is relevant - you need to change your web.config. – Jon Skeet Oct 27 '22 at 09:43
  • You are correct. It works. Dim upload = New Dictionary(Of Tuple(Of Long, Long, ResponseContent), Long). Thank you. – doctor boo Oct 27 '22 at 09:53

0 Answers0